Almost every time that you search for this error you will find a fix similar to the following:
<bindings>
<Binding>
<binding name="myBindingName">
<security mode="None" />
<readerQuotas
maxDepth="32"
maxStringContentLength="8196"
maxArrayLength="16384"
maxBytesPerRead="4096"
maxNameTableCharCount="16384"
/>
</binding>
</Binding>
</bindings>
Where [Binding] in the xml structure above is the type of binding that you are using: wshttp, netmsmq, etcWhat most of these posts will not explicitly tell you is that these settings should not only be changed on the CLIENT app but also in the HOST as well.By default, when you create a WCF Service Host you don’t have to create the bindings as it will properly function with the defaults. The trick here that I found is to simply create a custom binding on the host side, properly set the maxStringContentLength to a value that will allow your host to process messages and the problem will be solved. Don’t forget to set the client bindings to sufficient values as well.Personally, I think that this error is questionable but I can think of some DOS reasons why the setting should remain. I guess it’s something that you need to consider especially if you plan on receiving some huge data calls from the open public.
0 comments:
Post a Comment