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>

找不到匯入的專案  請確認 <Import> 宣告中的路徑正確,而且檔案存在於磁碟上。

【Problem】  C:\inetpub\wwwroot\project\project.csproj : error  : 找不到匯入的專案 "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\W...