C# 系统连接一段时间后出现System net web异常
我有一个asp.net应用程序连接到一个.net web服务,每当我登录并到达主页时,web服务都会返回数据 但如果我登录的时间可能超过1或2小时,当我单击我获得的任何链接时: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
"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服务器。没有会话概念,我不检查会话。获取该消息的一种方法是假设您已经连接(如在会话中)而不是每次通话前都连接到服务,这样上面的答案才有效