Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
OnShutdown event in a Windows Service
Message
From
30/03/2014 10:08:59
 
 
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01597504
Message ID:
01597681
Views:
24
>Seems you can set SCM service shutdown order using HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\PreshutdownOrder.

That is what I am looking at. Thanks for mentioning it as well.

>Also, there is the SetProcessShutdownParameters func : http://msdn.microsoft.com/en-us/library/windows/desktop/ms686227(v=vs.85).aspx - but I'm not sure it would help.

I will take a look at that. Thanks for the reference

>But I don't think any of the above will get round the time limit when there is a system shutdown - only the registry WaitToKillServiceTimeout affects that - and, AFAICS, that value is the time to allowed to shut down *all* services.
>
>Don't know what would happen if you set a high priority task to run on shutdown and made that responsible for shutting down the services. Might be an alternative?
>
>But, as before, the safest approach is to make service processes more atomic (i.e. interruptable). Can you give an example of a service job where that cannot be done ?

But, a 7-minute loop to execute is something that has to complete, if it is in progress, so the entire scenario is to block all closure of other services until ours are finished.

Also, the RequestAdditionalTime(30000) seems to have a maximum value. I cannot put a value to high in there. I haven't done much tests yet. But, so far, it seems, it the value is over that that it would not work. Also, when this is effective, I see that it gets into the OnShutDown a second time, after 30 seconds, but then, it will ignore a second request and will simply proceed with the OnShutDown.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform