WCF无法上传大图像文件

时间:2016-07-14 06:54:00

标签: wcf wcf-data-services

我在.net中创建了一个WCF REST,我无法在服务器上上传大文件。当我测试这些东西时,它会在PostMan Client上显示错误。

  

413请求太大

我更改了网页设置。对此。

<webHttpBinding>
        <binding name="webHttpBinding" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" transferMode="Streamed">
          <security mode="Transport">
            <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
          </security>
        </binding>
      </webHttpBinding>

这是我的请求流。

无法粘贴我的请求流。

1 个答案:

答案 0 :(得分:0)

要检查的几件事。

首先,你是否指定了&#34; webHttpBinding&#34;到一个明确的端点?类似这样的事情,在<system.serviceModel>部分:

<services>
  <service name="YourServiceName">
    <endpoint address="" binding="webHttpBinding"
              bindingConfiguration="webHttpBinding"
              contract="FullyQualified.IContractName" />
  </service>
</services>

除非你分配配置&#34; webHttpBinding&#34;通过bindingConfiguration属性到端点,将使用webHttpBinding的默认(较小)值。

或者,您可以通过省略webHttpBinding元素中的name属性,使您指定的配置成为<binding>的默认配置。

要检查的另一件事是配置文件中maxRequestLength元素中的<httpRuntime>值。您可以在配置文件的Int32.MaxValue部分指定最大值2147483647(<system.web>,基本上),如下所示:

<system.web>
  <httpRuntime maxRequestLength="2147483647" />
</system.web>
相关问题