I receive this error when I try to send things to a Webservice with WP7.
The formatter threw an exception while trying to deserialize the message: Error in deserializing body of request message for operation '
SubmitMobileData
'. The maximum string content length quota (8192) has been exceeded while reading XML data. This quota may be increased by changing theMaxStringContentLength
property on theXmlDictionaryReaderQuotas
object used when creating the XML reader. Line 178, position 21.
I figure its not my web service. Its actually my WP7 trying to serialize the data inside XML. Well my question is how do I set the XmlDictionaryReaderQuotas
.MaxStringContentLength
property in my WP7 app. I know how to set it on the Client of a Desktop App and inside a Webservice. But I CANT set it inside the App.XAML file of a WP7 App.
EDIT: I posted the client.config below. I decided to keep the service address open for those wanting to see about connecting to the service. When this question is hopefully answered, I will remove the wcf connection.
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IMobileUtilities" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<security mode="None" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://utopiapimp.com/services/MobileUtilities.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMobileUtilities"
contract="PimpMobileService.IMobileUtilities" name="BasicHttpBinding_IMobileUtilities" />
</client>
</system.serviceModel>
The specified exception is thrown when:
maxStringContentLength
reader quota (therefore the default one in used) or the quota is set too low;maxStringContentLength
reader quota.As the exception states, the error happened when deserializing body of request message for operation 'SubmitMobileData'.
Usually, the serialization occurs on client side and deserialization on service side. Therefore, reader quotas of the binding used by the web service must be added (or updated) to contain the
maxStringContentLength
attribute having value big enough for eachSubmitMobileData
invocation to succeed.EDIT:
Change configuration of your service's configuration to increase XML element content length limit. Do not copy this over your configuration, just merge it in:
EDIT: I appears that issue is with the service after all.
If the issue was on the client side, following exception would be thrown instead of the exception you are getting:
Since Silverlight assemblies are a subset of WP7 assemblies, reader quotas on client side are always set to max values.
This is part of XmlDictionaryReaderQuotas class definition: