2011-07-18 56 views
8

我有IIS 7.5 Windows 2008 R2上承载的WCF REST服务。该服务按预期工作,除非客户端尝试发送大于25 MB的消息。具体来说,当发送大约25 MB的消息时,服务会正确接收和处理消息,当发送大小为〜31 MB的消息时,它会失败。IIS 7.5托管的WCF服务抛出EndpointNotFoundException 404仅适用于大型请求

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

回答

13

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

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

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

0

,你可以尝试设置你的最大值为int最大女巫是2147483648,那你外面可能要考虑劈裂上传或流。

相关问题