增加 WCF 服务中的超时值 [英] Increasing the timeout value in a WCF service

查看:33
本文介绍了增加 WCF 服务中的超时值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将 WCF 服务的默认超时时间增加到 1 分钟以上?

How do I increase the default timeout to larger than 1 minute on a WCF service?

推荐答案

你指的是服务器端还是客户端?

Are you referring to the server side or the client side?

对于客户端,您需要调整绑定元素的 sendTimeout 属性.对于服务,您可能需要调整绑定元素的 receiveTimeout 属性.

For a client, you would want to adjust the sendTimeout attribute of a binding element. For a service, you would want to adjust the receiveTimeout attribute of a binding elemnent.

<system.serviceModel>
  <bindings>
    <netTcpBinding>
      <binding name="longTimeoutBinding"
        receiveTimeout="00:10:00" sendTimeout="00:10:00">
        <security mode="None"/>
      </binding>
    </netTcpBinding>
  </bindings>

  <services>
    <service name="longTimeoutService"
      behaviorConfiguration="longTimeoutBehavior">
      <endpoint address="net.tcp://localhost/longtimeout/"
        binding="netTcpBinding" bindingConfiguration="longTimeoutBinding" />
    </service>
....

当然,您必须将所需的端点映射到该特定绑定.

Of course, you have to map your desired endpoint to that particular binding.

这篇关于增加 WCF 服务中的超时值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆