.net Deserialization Serializer Does Not Work When Line Length Exceeds 32768 Characters

I have a way like this:

var stringReader = new StringReader(ruleSetXmlDefinition); var reader = XmlReader.Create(stringReader); var serializer = new WorkflowMarkupSerializer(); return serializer.Deserialize(reader) as RuleSet; 

When the ruleSetXmlDefinition rule exceeds 32768 characters, I get the following error:

Unexpected end of file while parsing name. Line 1, position 32768.

How can I change this so that it can handle strings of any length?

+4
source share
2 answers

I suspect that you can configure Wcf to accept large arrays, see also this answer:

Sort of

 <netTcpBinding> <binding name="NetTcpBinding_ImageResizerServiceContract" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxConnections="10" maxReceivedMessageSize="2147483647"> <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" /> <security mode="Transport"> <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" /> <message clientCredentialType="Windows" /> </security> </binding> </netTcpBinding> 
+3
source

I found the answer to this problem, and unfortunately it was something really obvious ... the line I was going through was actually truncated, so the problem was that the xml was not well formed.

+1
source

Source: https://habr.com/ru/post/1381911/


All Articles