It is a very productive day today. Have to create a new wcf service and published it as basicHttpBinding, because the service is taking a xml data, so the message size is very possibile to execeed the default 8096 bytes limit.
So the wcf service config needs to be set up with the correct settings such as,
<bindings>
<basicHttpBinding>
<binding name="basicHttp" allowCookies="true"
maxReceivedMessageSize="20000000"
maxBufferSize="20000000"
maxBufferPoolSize="20000000">
<readerQuotas maxDepth="32"
maxArrayLength="200000000"
maxStringContentLength="200000000"/>
</binding>
</basicHttpBinding>
</bindings>
Also in service, the bindingConfiguration should be used such as,
<services>
<service name="Example.Services.TestService">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttp" contract="Example.Services.ITestService"/>
</service>
</services>
I have done it a few times, so I just copied & pasted from other service settings and modify it to the one for this service name.
But after a few hours testing, I am still keeping get the "message exceeds the size error". Have to carefully check the web.config and no way find any error for the settings.
In the end, I just removed the old web.config, and bring it up the WCFServiceConfiguration tool to browse to the service assmebly and use the tool to create the correct basicHttpBinding.
Then it worked !!!
The lesson I got from it is, we should use the WCF configuration tool to create the correct config file rather than just copy & paste, which is error-prone and easily can miss something and stucked.
No comments:
Post a Comment