Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
DotNet
acad.assignment.mngr
academic
adonet
aspnet
aspnet.announcements
aspnet.build.controls
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
clr
compactframework
component_services
datatools
distributed_apps
drawing
faqs
framework
framework.wmi
general
internationalization
interop
languages.csharp
languages.jscript
languages.vb
languages.vb.controls
languages.vb.data
languages.vb.upgrade
languages.vc
languages.vc.libraries
myservices
odbcnet
performance
remoting
scripting
sdk
security
setup
vjsharp
vsa
webservi.enhancements
webservices
windowsforms
windowsforms.controls
winforms.databinding
winforms.designtime
xml
  
 
date: Tue, 19 Apr 2005 14:20:48 +0200,    group: microsoft.public.dotnet.myservices        back       


controlling windows service start and stop (shutdown) timeout   
Hello,

Is there some way to control SCM timeout while starting or stopping a C#
windows service? I know I can work on a different thread and quickly return
from OnStart(), but I'd like my service to shutdown gracefully, and it takes
a long time to save all data while exiting.

Thanks for any help,
Jan
date: Tue, 19 Apr 2005 14:20:48 +0200   author:   Jan Waga

Re: controlling windows service start and stop (shutdown) timeout   
Jan Waga wrote:
> Hello,
> 
> Is there some way to control SCM timeout while starting or stopping a C#
> windows service? I know I can work on a different thread and quickly return
> from OnStart(), but I'd like my service to shutdown gracefully, and it takes
> a long time to save all data while exiting.
> 
> Thanks for any help,
> Jan

There is a way in the Win SDK which .NET uses.
Part of the low level API provides a way for your service to HINT to the 
SCM.

But .NET does not expose this (and a lot of other useful features!).

If .NET would ALSO expose its internal SCM handle, then you could call 
WIN32 directly for the places it falls short.

I'm with you, I think all of this wonderful stuff should be there.

- Lee
date: Wed, 20 Apr 2005 09:55:23 -0700   author:   Lee Gillie

Re: controlling windows service start and stop (shutdown) timeout   
Thank you, yesterday I found your post on DotNetMonster (or similar NET
portal, I don't recall). I guess I have to write ordinary C++ service and
call a process.

Jan
date: Thu, 21 Apr 2005 08:10:58 +0200   author:   Jan Waga

Re: controlling windows service start and stop (shutdown) timeout   
"Lee Gillie"  wrote in message 
news:erOu$mcRFHA.3104@TK2MSFTNGP10.phx.gbl...
> Jan Waga wrote:
>> Hello,
>>
>> Is there some way to control SCM timeout while starting or stopping a C#
>> windows service? I know I can work on a different thread and quickly 
>> return
>> from OnStart(), but I'd like my service to shutdown gracefully, and it 
>> takes
>> a long time to save all data while exiting.
>>
>> Thanks for any help,
>> Jan
>
> There is a way in the Win SDK which .NET uses.
> Part of the low level API provides a way for your service to HINT to the 
> SCM.
>
> But .NET does not expose this (and a lot of other useful features!).
>
> If .NET would ALSO expose its internal SCM handle, then you could call 
> WIN32 directly for the places it falls short.
>
> I'm with you, I think all of this wonderful stuff should be there.
>
> - Lee

This is taken care of in v2.0 - see ServiceBase.RequestAdditionalTime(msecs) 
method.
This method will hint the SCM to wait for additional msecs. time before it 
decides a start/stop ... pending request failed.

Willy.
date: Thu, 21 Apr 2005 11:24:36 +0200   author:   Willy Denoyette [MVP]

Re: controlling windows service start and stop (shutdown) timeout   
Willy Denoyette [MVP] wrote:
> This is taken care of in v2.0 - see ServiceBase.RequestAdditionalTime(msecs) 
> method.
> This method will hint the SCM to wait for additional msecs. time before it 
> decides a start/stop ... pending request failed.
> 
> Willy.

That's great! Maybe if you get a moment you can share what else is new? 
Do they expose the underlying API handle as well?

- Lee
date: Tue, 26 Apr 2005 09:40:28 -0700   author:   Lee Gillie

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us