maintan客户端在回发时连接30分钟. [英] maintan client connection on postback for 30 mins.

查看:155
本文介绍了maintan客户端在回发时连接30分钟.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的屏幕上有一个按钮,该按钮可通过调用第三方存储过程来获取数据表.但是存储过程需要大约30分钟的时间来执行并给出结果集.所以我应该实现什么功能来维护客户端和服务器之间的连接.

我尝试通过应用断点来测试30分钟的持续时间,但浏览器显示资源管理器状态为5分钟后未响应.

I have a button on my screen which gets a datatable by calling a third party store procedure. but store procedure took around 30 mins to execute and give result set.so what functionality should i implement to maintain connection between client and server.

i tried by applying a break point to test 30 mins duration but browser displays explorer status as not responding after 5 mins.

推荐答案

我不认为您应该在思考保持30分钟的连接状态(或以往如此).设计中肯定存在问题(如果您的呼叫花了半个小时才能获取数据,这是预期的问题.请尝试查看存储的proc并提高其性能.
I do not think that you should be thinking to keep alive your connection (or what so ever) alive for 30 mins. There is surely something wrong in design (or expectations if your call makes half an hour to get the data. Try to look at the stored proc and improve its performance.


使用(command.Connection = SQLConnectionFactory.GetConnection)
{
command.Connection.Open();
command.CommandTimeout = 1800000;
SqlDataReader reader = command.ExecuteReader();
table = new DataTable();
table.Load(reader);
command.Connection.Close();
}

并将其设置为无限设置命令.CommandTimeout= 0;
using (command.Connection = SQLConnectionFactory.GetConnection)
{
command.Connection.Open();
command.CommandTimeout = 1800000;
SqlDataReader reader = command.ExecuteReader();
table = new DataTable();
table.Load(reader);
command.Connection.Close();
}

and to set it infinite set command.CommandTimeout = 0;


这篇关于maintan客户端在回发时连接30分钟.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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