Coders, this problem is driving me crazy !! The last 2 days I have been doing extensive research, and I have no idea what is going on.
Problem: As the name says, I have a WCF service that is consumed by a Silverlight application. The problem is that whenever I try to use one of the WCF operations, I get this error:
The maximum length of the string length (8192) was exceeded when reading XML data.
I know that I should change the MaxStringContentLength value in the web.config file to fit the size of my message, but it seems to me that updating the MaxStringContentLength value is not reflected in the system. I tried updating the service link, rebuilt the whole solution without any luck, and still got the same error. Any idea on what I should do?
Solution Information:
Web.config
<system.serviceModel> <bindings> <basicHttpBinding> <binding name="BasicHttpBinding_Service1" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"> <readerQuotas maxDepth="32" maxStringContentLength="10000" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" /> <security mode="None"> <transport clientCredentialType="None" proxyCredentialType="None" realm="" /> <message clientCredentialType="UserName" algorithmSuite="Default" /> </security> </binding> </basicHttpBinding> </bindings> <client> <endpoint address="http://localhost:53931/WCF/Service1.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_Service1" contract="ServiceReference.Service1" name="BasicHttpBinding_Service1" /> </client> <behaviors> <serviceBehaviors> <behavior name=""> <serviceMetadata httpGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="false" /> </behavior> </serviceBehaviors> </behaviors> <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
ServiceReferences.ClientConfig
<configuration> <system.serviceModel> <bindings> <basicHttpBinding> <binding name="BasicHttpBinding_Service1" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" > <security mode="None" /> </binding> </basicHttpBinding> </bindings> <client> <endpoint address="http://localhost:53931/WCF/Service1.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_Service1" contract="ServiceReference.Service1" name="BasicHttpBinding_Service1" /> </client> </system.serviceModel>
Thanks in advance.
silverlight wcf
Eyad
source share