Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 系统连接一段时间后出现System net web异常_C#_Asp.net_Web Services - Fatal编程技术网

C# 系统连接一段时间后出现System net web异常

C# 系统连接一段时间后出现System net web异常,c#,asp.net,web-services,C#,Asp.net,Web Services,我有一个asp.net应用程序连接到一个.net web服务,每当我登录并到达主页时,web服务都会返回数据 但如果我登录的时间可能超过1或2小时,当我单击我获得的任何链接时: "System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected pa

我有一个asp.net应用程序连接到一个.net web服务,每当我登录并到达主页时,web服务都会返回数据

但如果我登录的时间可能超过1或2小时,当我单击我获得的任何链接时:

"System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond"

这有什么办法?谢谢。

这可能是因为您的会话已过期。在调用该服务器之前,您必须检查用户是否仍然连接到承载webservice的Web服务器。

没有会话概念,我不检查会话。获取该消息的一种方法是假设您已经连接(如在会话中)而不是每次通话前都连接到服务,这样上面的答案才有效