Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF returns 404 for large request, maxReceivedMessageSize="2147483647"

Tags:

wcf

Our WCF service on large request returns following error:

"System.ServiceModel.EndpointNotFoundException: There was no endpoint listening at http://xxx.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. ---> System.Net.WebException: The remote server returned an error: (404) Not Found.

For small requests everything works fine and I am getting correct response from WCF service, the issue is only with large requests.

Settings on the client are as follow:

 <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_ITestService" openTimeout="00:05:00" sendTimeout="00:05:00" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647" >
          <readerQuotas maxDepth="2147483647" maxBytesPerRead="2147483647" maxArrayLength="2147483647" maxStringContentLength="2147483647"
            maxNameTableCharCount="2147483647"/>
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost:33333/TestService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ITestService" contract="TestService.ITestService" name="BasicHttpBinding_ITestService" />
    </client>
  </system.serviceModel>

The settings of the WCF service:

 <bindings>
      <basicHttpBinding>
        <binding maxReceivedMessageSize="2147483647" receiveTimeout="00:10:00" sendTimeout="00:10:00" maxBufferSize="2147483647" maxBufferPoolSize="2147483647">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483646" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
        </binding>
      </basicHttpBinding>
    </bindings>

What can be the issue?

like image 999
DamianPawski Avatar asked Feb 24 '15 16:02

DamianPawski


1 Answers

In this case, the error was not with WCF but with the IIS settings. The Message was to large for IIS, I have added "maxAllowedContentLength" to the web.config on the server.

<system.webServer>
    <security>
      <requestFiltering>
        <requestLimits maxAllowedContentLength="2200000000"/>
      </requestFiltering>
    </security>

The error message was misleading.

like image 128
DamianPawski Avatar answered Nov 16 '22 01:11

DamianPawski