服务端的WCF绑定

时间:2014-02-11 05:42:09

标签: wcf

我们如何在WCF服务端定义具有最大缓冲区大小的绑定,而不是在客户端执行。有人可以告诉我这是否可行?我不想在客户端自定义绑定。

1 个答案:

答案 0 :(得分:0)

这可能对你有所帮助!在 Web.Config 中添加 maxRequestLength = 214748364

<system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" maxRequestLength="2147483647" executionTimeout="300"/>    
</system.web>

如果不起作用请在 标记中添加。

<bindings>
      <webHttpBinding>
          <binding name="webHttpBG" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647"
maxBufferPoolSize="21474836470" closeTimeout="00:01:00" openTimeout="00:01:00"
            receiveTimeout="00:10:00" sendTimeout="00:01:00">
              <security mode="None"/>
          </binding>

      </webHttpBinding>
  </bindings>

并在 标记中。做这样的事。

<services>
  <service behaviorConfiguration="" name="Your.Service.Name">
    <endpoint address="" behaviorConfiguration="RESTBehavior" binding="webHttpBinding"
      bindingConfiguration="webHttpBG" contract="Your.Package.IContract" />
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:51855/Contract.svc" />
      </baseAddresses>
    </host>
  </service>
相关问题