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

时间秒杀一切 提交于 2019-12-04 11:00:52

问题


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>

回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/6737065/iis-7-5-hosted-wcf-service-throws-endpointnotfoundexception-with-404-only-for-la

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!