2015-02-24 235 views
1

我們WCF大請求返回下面的錯誤服務:WCF的大請求返回404,maxReceivedMessageSize =「2147483647」

「System.ServiceModel.EndpointNotFoundException:沒有終點的http://xxx.svc是可以接受的消息聽。 ---> 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

可能重複:http://stackoverflow.com/questions/17572500/wcf-error-there-was-no-endpoint-listening-at – Mike 2015-02-24 18:09:01

+0

我有上述問題提供的設置。 – DamianPawski 2015-02-25 11:43:05

回答

8

在這種情況下,錯誤不是在WCF中,而是在IIS設置下。 該消息對於IIS來說很大,我在服務器上的web.config中添加了「maxAllowedContentLength」。

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

錯誤消息是誤導性的。

+0

@DamienPawski你是怎麼弄出來的? – 0x4f3759df 2016-11-29 14:46:42

+0

我希望我能給10個upvotes。謝謝! – denvercoder9 2017-05-02 20:55:19

0

在我的情況下,即使嘗試所有解決方案並將所有限制設置爲最大值後,它仍然無法正常工作。在最後,我發現IIS /網站上安裝了一個微軟IIS過濾模塊Url Scan 3.1,它有自己的限制,根據內容大小拒絕傳入的請求並返回「404未找到頁面」。

通過將MaxAllowedContentLength設置爲所需的值,可以更新%windir%\System32\inetsrv\urlscan\UrlScan.ini文件中的限制。

例如,以下將允許高達300 MB的請求

MaxAllowedContentLength = 314572800