我有一个WCF REST服务,托管在IIS 7.5 Windows 2008 R2上。该服务的工作正常,除非客户端试图发送大于约25 MB的消息。具体来说,当发送大小为约25 MB的消息时,服务可以正确接收和处理消息;当发送大小为约31 MB的消息时,服务将失败。
在VS 2010本地托管时,消息会被成功接收而不会出现错误。但是,在远程IIS 7.5上托管时,服务立即响应:"System.ServiceModel.EndpointNotFoundException:没有侦听地址...",内部异常是:"远程服务器返回了一个错误:(404)未找到"。
这与最大消息大小设置不足引发的异常不同。考虑到本地托管时没有出现错误,我的猜测是它与IIS或某些防火墙设置有关。
以下是配置内容:
在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>