开发者

How to prolong the waiting period of a windows service shutting down?

Using RequestAdditionalTime for a windows service, does not prolong the waiting period long enough. I have to wait for a job to finish , so i keep on

            while (gs_bisProcessing)
            {
                OnRequestMoreTime(20000);
                Thread.Sleep(20000);
            }

but still the job takes long enough that the service while stopping, gives the message box that the service did not respond in a timely fashion... and teh state of the service stays 开发者_如何转开发'Stopping' even if you refresh. So what to do now? I want to do the same thing onShutdown too? Any ideas?


Did you mean RequestAdditionalTime(ms)?

I'd probably check prior to 20 seconds elapsing, that seems to be about the magic number. I wouldn't sleep that long, but probably be checking your flag every 10-15 seconds instead.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜