开发者

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

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 maximu开发者_JAVA技巧m 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>


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)".


you can try setting your max values to int max witch is 2147483648, outside of that you may want to consider spliting the upload or streaming.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜