Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IIS 7.5 hosted WCF service throws EndpointNotFoundException with 404 only for large requests

Tags:

wcf

iis-7.5

I have a WCF REST service hosted on IIS 7.5 Windows 2008 R2. The service works as expected except when a client attempts to send a message larger than ~ 25 MB. Specifically, when sending a message size of ~ 25 MB the service receives and processes the message properly, when sending a message of size ~ 31 MB it fails.

When hosted locally on VS 2010 the message is received without error. When hosted remotely on IIS 7.5, the service immediately responds with: "System.ServiceModel.EndpointNotFoundException : There was no endpoint listening at ...", the inner exception is: "The remote server returned an error: (404) Not Found".

This is different from the exception raised when the maximum message size setting is insufficient. Given that when hosted locally I'm not getting an error my guess is that it has something to do with either IIS or perhaps some firewall settings.

This is the config:

  <system.web>
    <compilation debug="true" targetFramework="4.0" />
    <httpRuntime requestPathInvalidCharacters="" maxRequestLength="512000"/>
  </system.web>
  <system.serviceModel>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true"/>
    <bindings>
      <webHttpBinding>
        <binding maxReceivedMessageSize="524288000" maxBufferSize="524288000">
          <readerQuotas maxStringContentLength="524288000" maxArrayLength="524288000"/>
        </binding>
      </webHttpBinding>
    </bindings>
  </system.serviceModel>
like image 658
eulerfx Avatar asked Jul 18 '11 17:07

eulerfx


1 Answers

It's the maximum upload size of IIS that bites you. It's default value is 30MB. You can fix it in web.config:

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

You can also change it in the IIS manager, somewhere in Request Filtering / Feature Settings. The value to fix is "Maximum allowed content length (bytes)".

like image 156
Codo Avatar answered Oct 04 '22 13:10

Codo