1

Question, I have a windows service running a task every one minute, It's connecting to a server and runs some kind of job on that server,but today i got an error from the server "WebException: The operation has timed out", the admin was changing some parameters so I got that error and my windows service couldn't connect any more on server, so when I restarted my service it connected momentarily.My question is it nececary to restart win service every time if that kind of error happens, I tout that win service would connect automatically without any kind of interaction from my side, or I have to write some kind of code to do that?

4

1 回答 1

1

要处理异常,您需要将 TRY{}Catch 放入您的代码中。并且它总是有助于维护日志。在每个 try catch 和 finally 语句中输入日志。也请记住在最后声明中关闭所有打开的连接.......

于 2013-06-18T11:56:26.820 回答