【问题标题】:The remote server returned an error: (413) Request Entity Too Large + WCF远程服务器返回错误:(413) Request Entity Too Large + WCF
【发布时间】:2012-10-05 02:12:18
【问题描述】:

可能这个问题是重复的。我有一个 WCF 上传服务,客户端通过该服务将特定文件上传到服务器。

我可以通过该服务成功发送大小为 12MB 的文件。

现在我已将一个自我认证的 SSL 证书集成到 WCF 服务中。相同的应用程序在没有 SSL 的情况下运行良好,现在返回一个错误,指出远程服务器返回了一个错误 (413) 请求实体太大。

我该如何解决这个错误,这与 SSL 有关吗?

我哪里错了。

<system.serviceModel>

<bindings>
  <basicHttpBinding>
    <binding name="customHttpBinding" openTimeout="00:10:00" sendTimeout="00:10:00"
     maxReceivedMessageSize="10067108864"
      messageEncoding="Mtom" transferMode="Streamed">          
      <security mode="Transport">
        <transport clientCredentialType="Certificate" />
      </security>
    </binding>
  </basicHttpBinding>
</bindings>

<behaviors>
  <serviceBehaviors>
    <behavior name="customServiceBehavior">
      <serviceMetadata httpsGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="true"/>

      <serviceCredentials>
        <clientCertificate>
          <authentication certificateValidationMode="PeerOrChainTrust" trustedStoreLocation="LocalMachine"/>
        </clientCertificate>
      </serviceCredentials>

    </behavior>
  </serviceBehaviors>
</behaviors>

<services>
  <service behaviorConfiguration="customServiceBehavior" name="FileTransferService">
    <endpoint address="" binding="basicHttpBinding" bindingConfiguration="customHttpBinding"
      contract="IFileTransferService" />
  </service>
</services>

谢谢

【问题讨论】:

    标签: wcf


    【解决方案1】:

    这似乎是修复 413 Request Entity too large 错误的门票with WCF over HTTPS

    C:\Windows\System32\inetsrv>appcmd.exe set config "Default Web Site" -section:system.webServer/serverRunTime /uploadReadAheadSize:10485760 /commit:apphost
    

    原因似乎与 IIS 如何通过 SSL 处理传入请求的身份验证有关。

    另一个资源:http://blogs.msdn.com/b/jiruss/archive/2007/04/13/http-413-request-entity-too-large-can-t-upload-large-files-using-iis6.aspx

    我下午的大部分时间都在跟踪这个问题...许多其他建议对我没有多大帮助,但这确实对我有帮助,所以希望这能让你解决问题。

    【讨论】:

    • 谢谢!刚刚拯救了我的下午!
    • 是的,这似乎只是 SSL 的问题。还有一个时间成分。我发现只有在 https 请求之间允许 100 秒传递时才会出现错误。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-09-15
    • 1970-01-01
    • 2016-10-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多