【问题标题】:IIS 7.5 hosted WCF service throws EndpointNotFoundException with 404 only for large requestsIIS 7.5 托管的 WCF 服务仅针对大型请求抛出带有 404 的 EndpointNotFoundException
【发布时间】:2011-07-18 17:49:29
【问题描述】:

我有一个托管在 IIS 7.5 Windows 2008 R2 上的 WCF REST 服务。该服务按预期工作,除非客户端尝试发送大于 ~ 25 MB 的消息。具体来说,当发送大小约为 25 MB 的消息时,服务会正确接收并处理消息,而当发送大小约为 31 MB 的消息时,它会失败。

当在 VS 2010 上本地托管时,收到的消息没有错误。当远程托管在 IIS 7.5 上时,该服务立即响应:“System.ServiceModel.EndpointNotFoundException:没有端点正在监听...”,内部异常是:“远程服务器返回错误:(404)未找到” .

这与最大邮件大小设置不足时引发的异常不同。鉴于在本地托管时我没有收到错误,我的猜测是它与 IIS 或某些防火墙设置有关。

这是配置:

  <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>

【问题讨论】:

    标签: wcf iis-7.5


    【解决方案1】:

    这是 IIS 的最大上传大小。它的默认值为 30MB。你可以在web.config修复它:

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

    您也可以在 IIS 管理器中的请求过滤/功能设置中的某处更改它。要修复的值是“最大允许内容长度(字节)”。

    【讨论】:

      【解决方案2】:

      您可以尝试将您的最大值设置为 int max 女巫为 2147483648,除此之外您可能需要考虑拆分上传或流式传输。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2015-06-11
        • 2013-10-01
        • 1970-01-01
        • 2011-02-05
        • 2013-07-14
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多