Hello Everyone,
I have made 2 Win-forms applications. They pass data to each other and its mostly in string format. They are windows desktop applications.
However if string content becomes a bit bigger I get the following error:
"The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:Code. The InnerException message was 'There was an error deserializing the object of type System.String[]. The maximum string content length quota (8192) has been exceeded while reading XML data. This quota may be increased by changing the MaxStringContentLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader. Line 216, position 104.'. Please see InnerException for more details."
The code that creates the server is here
Code:
Try
host = New ServiceHost(GetType(MainServerCode), New Uri("http://localhost:6767"))
host.AddServiceEndpoint(GetType(MainInterface), New BasicHttpBinding(), "Editor")
host.Open()
Catch ex As Exception
End If
The code that fires the string is here
Code:
Try
Dim B As New BasicHttpBinding()
B.MaxBufferSize = B.MaxBufferSize * 3
B.MaxReceivedMessageSize = B.MaxBufferSize
'B.ReaderQuotas = System.Xml.XmlDictionaryReaderQuotas.Max
B.GetType().GetProperty("ReaderQuotas").SetValue(B, XmlDictionaryReaderQuotas.Max, Nothing)
Dim httpFactory As New ChannelFactory(Of TAFunc)(B, New EndpointAddress("http://localhost:6768/XXX"))
Dim httpProxy As TAFunc = httpFactory.CreateChannel(), R(-1), D(-1) As String
httpProxy.RunScript(name, scode, type, nbar, R, D)
' array sc code contains textual data (string)
Result = R
DebugData = D
Catch ex As Exception
Debug.Print(ex.Message)
End Try
I don't know how to solve it. Please help. If string content becomes bigger program fails. If its small then okay. There are no config files in the project.
Thank you,
Regards,
GR