WCF weird behavior. (An error occurred while receiving the HTTP response)
I'm receiving this weird exception when calling a WCF function that returns a list of items. apparently when the size of list gets bigger this exception is thrown.
"An error occurred while receiving the HTTP response to http://localhost:8731/WMON/Database/...CeDBWcfService. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details."
The WCF service functions properly because when the client calls the function, it gets called from the service end point (I tested by placing a break point). Also the service has not shut down because on a multiple attempt of calling the function after the exception is thrown, the service code gets executed (tested using break points again). What could this error be?
Re: WCF weird behavior. (An error occurred while receiving the HTTP response)
Increase the maxStringContentLength in the binding.
Code:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="Wmon.Basic.Binding"
maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="32"
maxStringContentLength="2147483647"
maxArrayLength="16384"
maxBytesPerRead="4096"
maxNameTableCharCount="16384" />
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="WmonEndpoint"
behaviorConfiguration="Wmon.Basic.Behavior">
<endpoint name="WmonEndpoint.Binding"
...
binding="basicHttpBinding"
bindingConfiguration="Wmon.Basic.Binding"
... />
<host>
<baseAddresses>
<add baseAddress="http://localhost:5071/WmonEndpoint" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="Wmon.Basic.Behavior">
<serviceMetadata httpGetEnabled="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
<!-- <serviceDebug includeExceptionDetailInFaults="false"/> -->
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>