2011-07-18 59 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,那你外面可能要考慮劈裂上傳或流。

相關問題