(413)请求实体太大 - 在Azure上上载Wcf时

时间:2015-10-21 09:52:04

标签: c# wcf azure

我有一个Wcf服务,当在本地whith visual studio中使用时工作完美,但当我在Azure上部署它时,它会返回“(413)Request Entity Too Large”错误,当我尝试传递一个byte []时。

我上传的web.config文件是这样的:

<?xml version="1.0"?>
<configuration>
  <system.diagnostics>
    <trace>
      <listeners>
        <add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
      name="AzureDiagnostics">
          <filter type="" />
        </add>
      </listeners>
    </trace>
  </system.diagnostics>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
  </system.web>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding maxReceivedMessageSize="2147483647"
    maxBufferSize="2147483647"
    maxBufferPoolSize="2147483647">
          <readerQuotas maxDepth="32"
      maxArrayLength="2147483647"
      maxStringContentLength="2147483647"/>
        </binding>
      </basicHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the value below to false before deployment -->
          <serviceMetadata httpGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>

      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <!--
    To browse web app root directory during debugging, set the value below to true.
    Set to false before deployment to avoid disclosing web app folder information.
-->
    <directoryBrowse enabled="true"/>
  </system.webServer>
</configuration>

1 个答案:

答案 0 :(得分:2)

检查此链接可以帮助你:

(413) Request Entity Too Large

IIS7 - (413) Request Entity Too Large | uploadReadAheadSize

还检查客户端webconfig是否也具有相同的绑定名称。