Okay so I've set up and tested a nice little WCF service. The client creates a string and passes it into a method on the service and the service then saves it as a file. Works perfectly with small amounts of test data but when I try it with what it's supposed to do - pass some serialized .net objects - it falls over, with the error
The formatter threw an exception while trying to deserialize the message: Error in deserializing body of request message for operation 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
So I goggle this and find that the MaxStringContentLength property should be set on a "readerQuotas" tag within the tag of the config file, like this:
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
So I change it. I change it on the App.config file of my client. I change it on the App.config file and the Web.config file of my server. I change it in the App.config file of my unit test project. And none of it works - I keep getting the same error.
Interesting, and frustratingly, when I fired up WcfClient.exe to have a look at my service, connected to it and has a look at the config file (Client.dll.config) I was gobsmacked to find that this auto-generated file contained none of my changes and has reset to:
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
I have no idea where it's getting these values from - nowhere in my entire solution are these being set. So it must be using defaults, but I don't understand why it's using defaults when I've provided custom Config files at both server and client.
Can anyone help me untangle this?
1) Is it possible that your endpoint isn't properly referencing the custom binding? Could you post your binding and endpoint sections?
2) WcfTestClient doesn't use your service or client configs to set its own configuration. You'll need to manually edit the Client.dll.config with SvcConfigEditor to set up the WcfTestClient client binding data before executing the service.
You can persist your WcfTestClient configuration changes if you look at the Tools -> Options menu. For more information on WcfTestClient, check this out: http://msdn.microsoft.com/en-us/library/bb552364.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With