Wednesday, 15 November 2017

遠端伺服器傳回未預期的回應 413 Request Entity Too Large

遠端伺服器傳回未預期的回應 413 Request Entity Too Large

主因為WCF無法承接過大的資料量

解決方式在Web跟WCF二端web.config進行相關設定

其一:Web下的Web.config增加一個沒有設置名字的默認配置
<binding name="BasicHttpBinding_IService1" closeTimeout="00:03:00" openTimeout="00:03:00" receiveTimeout="00:03:00" sendTimeout="00:03:00" maxBufferSize="4086000" maxReceivedMessageSize="4086000" />
<binding name="BasicHttpBinding_IService11" closeTimeout="00:03:00" openTimeout="00:03:00" receiveTimeout="00:03:00" sendTimeout="00:03:00" maxBufferSize="4086000" maxReceivedMessageSize="4086000" />
<binding name="BasicHttpBinding_IService12" closeTimeout="00:03:00" openTimeout="00:03:00" receiveTimeout="00:03:00" sendTimeout="00:03:00" maxBufferSize="4086000" maxReceivedMessageSize="4086000" />
<binding   closeTimeout="00:10:00" receiveTimeout="00:20:00" sendTimeout="00:20:00"
maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">

其二:WCF端下的Web.config的<system.serviceModel>中,增加<bindings>設定
<configuration>
<system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding maxReceivedMessageSize="2147483647"
                 maxBufferSize="2147483647"
                 maxBufferPoolSize="2147483647">
          <readerQuotas maxDepth="32"
                        maxArrayLength="2147483647"
                        maxStringContentLength="2147483647"/>
        </binding>
      </basicHttpBinding>
    </bindings>
</system.serviceModel>
</configuration>









No comments:

Post a Comment

IIS HTTP Error 403.18

 HTTP Error 403.18 - Forbidden The specified request cannot be processed in the application pool that is configured for this resource on the...