且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何抑制连接超时错误?

更新时间:2023-12-05 11:28:46



超时错误有多种原因,
所以您只需检查一下调试,
如果有一个查询的执行时间比服务器响应时间长,那么您只需找出原因,这就是您要优化查询以解决会话超时错误的原因,


祝你好运


there are multiple reason for timeout error,
so you just check through debugging,
if there are one of query whose execution time is so long than server responding time, so you just find out this,and this is a reason then you just optimize your query for resolving session timeout error,


good luck


为什么要压抑它?应该处理.

为了跟踪它们,只需将与超时相关的代码放在try-catch块中.
Why do you want to suppress it? It should be handled.

In order to keep a track of them, just put the code related to timeout in try-catch block.
try
{
   //Probable Connection timeout code
   //e.g.: Connect to DB code
   // Do your stuff
}
catch (Exception ex)
{
   // Log it
   // Or eat it!
}