简体   繁体   English

服务端的WCF绑定

[英]WCF bindings at service side

How can we define bindings with Max buffer size at WCF service side rather than doing at client side. 我们如何在WCF服务端而不是在客户端定义最大缓冲区大小的绑定。 Can somebody let me know if this is feasible? 有人可以告诉我这是否可行吗? I do not want to customize bindings at client side. 我不想在客户端自定义绑定。

This may help you! 这可能对您有帮助! Add maxRequestLength=214748364 in Web.Config . Web.Config中添加maxRequestLength = 214748364

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

And if it doesn't work Add this in 如果不起作用,请在其中添加 tag. 标签。

<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>

And in your 在你的 tag. 标签。 Do something like this. 做这样的事情。

<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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM