I've been working with complex reporting application and big part of the application relies on Web Services.The client requests some operations by calling the Web Methods. The Web Service basically does everything on the sever where it is deployed and returns data to the client as byte[] array. When we have some more complex methods, the maximum message size quota (which is 65536 by default) is exceeded.When trying to get the byte[] back from the Web Servicebyte[] rep = serv.getReport(json); the error that is thrown is:
The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element. As it says, the MaxReceivedMessageSize property value should be increased.In Web.config under <system.serviceModel>, once you add web service reference, the bindings and client are generated.It should look something like this: <system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="Service1Soap" 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="8192" 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://hajan/mywebservapp/MyService.asmx" binding="basicHttpBinding" bindingConfiguration="Service1Soap" contract="HSServ.Service1Soap" name="Service1Soap"/>
</client>
</system.serviceModel>
So, pay attention on the <binding name="Service1Soap ...> element:Whole line:
<binding name="Service1Soap" 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"> Read more: Hajan's Blog
The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element. As it says, the MaxReceivedMessageSize property value should be increased.In Web.config under <system.serviceModel>, once you add web service reference, the bindings and client are generated.It should look something like this: <system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="Service1Soap" 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="8192" 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://hajan/mywebservapp/MyService.asmx" binding="basicHttpBinding" bindingConfiguration="Service1Soap" contract="HSServ.Service1Soap" name="Service1Soap"/>
</client>
</system.serviceModel>
So, pay attention on the <binding name="Service1Soap ...> element:Whole line:
<binding name="Service1Soap" 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"> Read more: Hajan's Blog
0 comments:
Post a Comment