Environment versions
Network:
Windows 2003 Server
>After having thought more of it, I am not sure if this is possible to accomplish.
>
>We cannot use Local System Account as this requires traversing the NAS. So, we need a domain account to run the Windows Service. In that mode, no interaction is allowed. So, if no interaction is allowed, it would then make sense that such functionality is not supported.
Yeah. Looks like the 'hidden form' approach gives you access to the message loop but still doesn't allow interaction with the desktop
>
>If there is a way, I would surely like to know about it. But, I have not found anyone on the net who succeeded to accomplish that. I have seen a lot of pages which deals with such actions but from a Windows form. Thus, a desktop application which is running can respond to an OnShutDown event and advise the user for some decision making.
>
>One way that has been suggested to me would be to use a very small Windows Service, a slave, with Local System Account, with the sole responsability to assure that all related Windows Services are properly closed and restarted when we restart the server. Thus, such service could then notify the user, when he does the restart, that he has to wait as we have some ongoing operations in progress. With Local System Account, the interaction with the desktop is allowed.
That might work but seems (perhaps of necessity) a little convoluted. Haven't looked closely but there are a couple of properties on ServiceBase that might help:
The RequestAdditionalTime() method in the OnStop() might have some effect.
There's also a CanShutDown property which will cause the OnShutdown event to fire - although I'm not sure what you can do with it.
There's also a registry setting which can increase the time the SCM will wait for a service to shutdown. See WaitToKillServiceTimeout.
But, at the end of the day, you should still program so that the service can shut down safely and coherently in a short period of time.
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only