WCF Configuration Files - and the Famous "Content Line Length Quota Length (8192)"

People,

Thanks for the help in my previous issue with the WCF configuration file. Here is a new one.

My project is a WinForms application client (.NET 4.0) that retrieves data from (and saves it) for WCF services hosted in IIS 7.0. When I keep a small payload, everything is fine. When I try to save a payload of more than 8192 bytes, the error is:

The formatter made an exception while trying to deserialize the message: an error occurred while trying to deserialize the http://tempuri.org/:objEncounterType parameter. The InnerException message was "Error deserializing an object of type PsychCoverage.Common.EncounterType. The maximum length of the quota string content (8192) was exceeded when reading XML data. This quota can be increased by changing the MaxStringContentLength property to the XmlDictionaryReaderQuotas object used to create the XML reader. Line 1, position 10809. '. See InnerException for more information.

I have confirmed that my <binding name=""> matches my <endpoint bindingConfiguration=""> .

I set for all maxReceivedMessageSize and maxBufferPoolSize and maxBufferSize all 10,000,000 for both my app.config client and my web.config . I tried to make my <readerQuota> values ​​very high.

In my web.config, I set <httpRuntime maxRequestLength="10000000" />

This is from my app.config client:

 <system.serviceModel> <bindings> <basicHttpBinding> <binding name="wcfAdmin_binding" maxReceivedMessageSize="10000000" maxBufferPoolSize="10000000" maxBufferSize="10000000" messageEncoding="Text" sendTimeout="00:05:00" receiveTimeout="00:05:00" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false" > <readerQuotas maxDepth="200" maxStringContentLength="10000000" maxArrayLength="16384" maxBytesPerRead="10000000" maxNameTableCharCount="16384" /> <security mode="None"></security> </binding> </basicHttpBinding> </bindings> <client> <clear/> <endpoint address="http://localhost/PsychCoverage/Admin.svc" name="AdminUIClientEndpoint" binding="basicHttpBinding" bindingConfiguration="wcfAdmin_binding" contract="PsychCoverage.Common.IAdmin"> <identity> <dns value="localhost" /> </identity> </endpoint> </client> </system.serviceModel> 

And this is from my web.config service:

 <system.serviceModel> <serviceHostingEnvironment multipleSiteBindingsEnabled="False" ></serviceHostingEnvironment> <bindings> <basicHttpBinding> <binding name="wcfAdmin_binding" maxReceivedMessageSize="10000000" maxBufferPoolSize="10000000" maxBufferSize="10000000" messageEncoding="Text" sendTimeout="00:05:00" receiveTimeout="00:05:00"> <readerQuotas maxDepth="200" maxStringContentLength="10000000" maxArrayLength="16384" maxBytesPerRead="10000000" maxNameTableCharCount="16384" /> <security mode="None"></security> </binding> <binding name="wcfClientWebPortal_binding" maxReceivedMessageSize="10000000" maxBufferPoolSize="10000000" maxBufferSize="10000000" messageEncoding="Text" sendTimeout="00:05:00" receiveTimeout="00:05:00"> <readerQuotas maxDepth="200" maxStringContentLength="10000000" maxArrayLength="16384" maxBytesPerRead="10000000" maxNameTableCharCount="16384" /> <security mode="None"></security> </binding> </basicHttpBinding> </bindings> <services> <service behaviorConfiguration="wcfBehavior" name="PsychCoverage.WcfMT.Admin"> <endpoint address="" binding="basicHttpBinding" bindingConfiguration="wcfAdmin_binding" name="AdminEndpoint" bindingName="wcfAdmin_binding" contract="PsychCoverage.Common.IAdmin"> <identity> <dns value="localhost" /> </identity> </endpoint> </service> <service behaviorConfiguration="wcfBehavior" name="PsychCoverage.WcfMT.ClientWebPortal"> <endpoint address="" binding="basicHttpBinding" bindingConfiguration="wcfClientWebPortal_binding" name="ClientWebPortalEndpoint" bindingName="wcfClientWebPortal_binding" contract="PsychCoverage.Common.IClientWebPortal"> <identity> <dns value="localhost" /> </identity> </endpoint> </service> </services> <behaviors> <serviceBehaviors> <behavior name="wcfBehavior"> <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> <serviceMetadata httpGetEnabled="False" /> <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> <serviceDebug includeExceptionDetailInFaults="true" /> <serviceThrottling maxConcurrentCalls="100" maxConcurrentSessions="100" maxConcurrentInstances="100" /> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel> 

Thank you very much in advance.

+6
source share

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


All Articles