我们对大型请求的WCF服务返回以下错误:
" System.ServiceModel.EndpointNotFoundException:http://xxx.svc没有可以接受该消息的端点。这通常是由错误的地址或SOAP操作引起的。有关更多详细信息,请参阅InnerException(如果存在)。 ---> System.Net.WebException:远程服务器返回错误:(404)Not Found。
对于小请求,一切正常,我从WCF服务得到正确的响应,问题只出在大请求上。
客户端上的设置如下:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_ITestService" openTimeout="00:05:00" sendTimeout="00:05:00" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647" >
<readerQuotas maxDepth="2147483647" maxBytesPerRead="2147483647" maxArrayLength="2147483647" maxStringContentLength="2147483647"
maxNameTableCharCount="2147483647"/>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:33333/TestService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ITestService" contract="TestService.ITestService" name="BasicHttpBinding_ITestService" />
</client>
</system.serviceModel>
WCF服务的设置:
<bindings>
<basicHttpBinding>
<binding maxReceivedMessageSize="2147483647" receiveTimeout="00:10:00" sendTimeout="00:10:00" maxBufferSize="2147483647" maxBufferPoolSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483646" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
可能是什么问题?
答案 0 :(得分:10)
在这种情况下,错误不是使用WCF而是使用IIS设置。 消息对于IIS很大,我添加了&#34; maxAllowedContentLength &#34;到服务器上的web.config。
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2200000000"/>
</requestFiltering>
</security>
错误消息具有误导性。
答案 1 :(得分:0)
就我而言,即使在尝试所有解决方案并将所有限制设置为最大值后,它仍无法正常工作。最后我发现在IIS /网站上安装了一个Microsoft IIS过滤模块Url Scan 3.1,它有自己的限制来根据内容大小拒绝传入请求并返回“404 Not found page”。
通过将%windir%\System32\inetsrv\urlscan\UrlScan.ini
设置为所需的值,可以在MaxAllowedContentLength
文件中更新此限制。
例如。以下将允许最多300 MB的请求
MaxAllowedContentLength = 314572800