Service not starting after reboot

G

Guest

I have a c# windows service that works fine when started manually. The
Startup type is set to automatic, yet if the machine rebotted, the service
fails to start unless I start it manually.

The service needs to have SQL Server running first and I came across this
article
http://support.microsoft.com/default.aspx?scid=kb;en-us;193888&Product=win2000
which explains how to setup a 'DependOnService' registry value. When I try
to do this on a Windows 2000 machine, the only options I have are, String,
Binary and DWORD. How do I programatically create a 'DependOnService' with
data type REG_MULTI_SZ

Thanks

Aplogies if this is wrong discussion group - I wasn't sure where to post.
 
W

Willy Denoyette [MVP]

jez123456 said:
I have a c# windows service that works fine when started manually. The
Startup type is set to automatic, yet if the machine rebotted, the service
fails to start unless I start it manually.

The service needs to have SQL Server running first and I came across this
article
http://support.microsoft.com/default.aspx?scid=kb;en-us;193888&Product=win2000
which explains how to setup a 'DependOnService' registry value. When I try
to do this on a Windows 2000 machine, the only options I have are, String,
Binary and DWORD. How do I programatically create a 'DependOnService' with
data type REG_MULTI_SZ

Thanks

Aplogies if this is wrong discussion group - I wasn't sure where to post.
Don't mess around in the registry, use the tools provided by the system to configure your
Windows Services.
From the command line you can use sc.exe, from managed code you can use System.Management
and WMI or you can spawn sc.exe using System.Diagnostics.Process.
Search MSDN for details on sc.exe or enter sc config /? from the command line.

Willy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top