IIS 7.5托管的WCF服务仅对大型请求抛出404抛出EndpointNotFoundException [英] IIS 7.5 hosted WCF service throws EndpointNotFoundException with 404 only for large requests

查看:65
本文介绍了IIS 7.5托管的WCF服务仅对大型请求抛出404抛出EndpointNotFoundException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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.

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

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

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

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.

这是配置:

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

推荐答案

这是IIS所困扰的最大上传大小.默认值为30MB.您可以在web.config中修复它:

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>

您还可以在IIS管理器中的请求过滤/功能设置中的某个位置进行更改.要修复的值为允许的最大内容长度(字节)".

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

这篇关于IIS 7.5托管的WCF服务仅对大型请求抛出404抛出EndpointNotFoundException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆