开发者

Instantiating ServiceController takes sometimes too much time

开发者 https://www.devze.com 2022-12-30 21:15 出处:网络
i am creating an instance of ServiceController using a remote/local machine name and the name of the service.开发者_如何学Go When I type sth. like stackoverflow.com as machine name the contructor bloc

i am creating an instance of ServiceController using a remote/local machine name and the name of the service.开发者_如何学Go When I type sth. like stackoverflow.com as machine name the contructor blocks for a long time and returns an exception.

Example:

string MachineName = "stackoverflow.com"
ServiceController("RemoteRegistry", MachineName );

How can I set here a kind of timeout to cancel this process?


This is subject to the standard TCP/IP connection time-outs. The same ones you see when trying to visit a web site that's off line with your browser. Yes, you can change them by editing the registry. You can make them longer. Not shorter.

Perhaps you can ping it first if this often fails.

0

精彩评论

暂无评论...
验证码 换一张
取 消