0

当我从我的 WP7 将照片上传到我的 WCF Web 服务时,我收到“413 Request Entity Too Large”,无论我做什么,我都无法阻止它发生。

我对 Web 服务的绑定信息是:

<bindings>
  <basicHttpBinding>
    <binding name="uploadfilebinding" closeTimeout="10:01:00"
      maxBufferSize="2147483646" maxBufferPoolSize="2147483646"
      maxReceivedMessageSize="2147483646" openTimeout="10:01:00"
      receiveTimeout="10:10:00" sendTimeout="10:01:00"
      messageEncoding="Mtom" transferMode="StreamedRequest">
      <readerQuotas maxDepth="2147483646" maxStringContentLength="2147483646"
                    maxArrayLength="2147483646" maxBytesPerRead="2147483646"
                    maxNameTableCharCount="2147483646" />
    </binding>
  </basicHttpBinding>
</bindings>

如您所见,我已将 maxReceivedMessageSize 设置为最高值,但无济于事,有人可以帮帮我吗?

我的服务器是“Windows Server 2008 R2 Standard”,该服务在 .NET 4 下运行。

提前致谢,

PS如果您需要更多信息,请询问,我会发布。

感谢您的回复:

由于这是一个 WP7 应用程序,客户端配置文件是由服务创建的名为“ServiceReferences.ClientConfig”的隐藏文件,其中的绑定现在为:

<bindings>
  <basicHttpBinding>
    <binding name="BasicHttpBinding_IMbcSync" closeTimeout="10:01:00"
      maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" openTimeout="10:01:00"
      receiveTimeout="10:10:00" sendTimeout="10:01:00"
      transferMode="StreamedResponse">
    </binding>
  </basicHttpBinding>
</bindings>

但我仍然遇到同样的错误。任何更多的建议将不胜感激?

4

1 回答 1

3

您可以将多个位置增加到最大可能大小。其中一些与 WCF 相关,其中一些与 IIS 相关。除了评论中提到的选项外,请尝试在服务器端的配置文件中增加以下内容(maxRequestLength 和 maxAllowedContentLength)以照顾 IIS 端:

<system.web>
  <httpRuntime maxRequestLength="2147483647" useFullyQualifiedRedirectUrl="true"   executionTimeout="14400"/>
</system.web>

  <system.webServer>
   <modules runAllManagedModulesForAllRequests="true"/>
    <security>
     <requestFiltering allowDoubleEscaping="true">
      <requestLimits maxAllowedContentLength="2147483647"/>
      <fileExtensions allowUnlisted="true"/>
      <verbs allowUnlisted="true"/>
     </requestFiltering>
    </security>
  </system.webServer>
于 2013-04-22T02:02:51.303 回答