如何增加与服务器长时间通讯的超时间隔 [英] how to incresed the timeout interval for long time communication to server

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

问题描述

我用C#开发了ASP.net项目.我在按钮单击事件上执行了脚本.在脚本中,我已经从mysql服务器访问了信息.如果数据库包含大量信息,则需要2到5分钟的脚本来执行此功能.当我使用按钮单击从服务器端到客户端访问数据时,它将断开服务器连接并显示消息,因为无法显示网页.

解决方案

您可以在配置级别进行操作.对于客户端,您需要调整绑定元素的sendTimeout属性.对于服务,您需要调整绑定元素的receiveTimeout属性.

 <   system.servicemodel  > 
  <  绑定 > 
    <   nettcpbinding  > 
    <  绑定    ="   longTimeoutBinding" <  安全性    ="   None" / <  /binding  > 
    <  /nettcpbinding  > 
   <  /bindings  > 

  <  服务 > 
    <  服务    ="   longTimeoutService" <  端点    ="   net.tcp://localhost/longtimeout/" > 
        binding ="netTcpBinding" bindingConfiguration ="longTimeoutBinding">

      <  /endpoint  > 
    <  /service  > 
  
<  /服务 >  <  /system.servicemodel  >  <   httpRuntime     ="   3600"  ...  / >  


i have developed the ASP.net project with C#.i have execute the script on button click event. in script i have accessed the information from the mysql server . if database contains lots of information then script required 2 to 5 min to execute this function.when i have accessed the data from server side to client side using button click it will disconnect the server connection & display the message as web page can not displayed .
how to incresed the timeout interval for long time communication to server?

解决方案

You can do at the configuration level. 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 element.

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

      </endpoint>
    </service>
  
</services></system.servicemodel>


You can increase execution timeout by setting executionTimeout attribute of httpRuntime element within web.config file under system.web element.

<httpRuntime executionTimeout="3600" ... />


这篇关于如何增加与服务器长时间通讯的超时间隔的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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