Service project

C

Curious

I have a .NET project whose final products are two background services
that you can see, start, or stop in the "Services" panel.

I have a folder containing the executables in the form of .dll
and .exe. How can I use the executables to start the services?
 
D

DArnold

Curious said:
I have a .NET project whose final products are two background services
that you can see, start, or stop in the "Services" panel.

I have a folder containing the executables in the form of .dll
and .exe. How can I use the executables to start the services?

You have to use the .Net Framework Service Controller in code.
 
C

Curious

They're both defined as sub-classes of
"System.ServiceProcess.ServiceBase". I've built the executables. But
don't know how to get the services started.
 
M

Mr. Arnold

Curious said:
They're both defined as sub-classes of
"System.ServiceProcess.ServiceBase". I've built the executables. But
don't know how to get the services started.

This is how I have done it which works the same way in VB or C#.Net

Dim theServiceController as System.ServiceProcess.ServiceController
me.theServiceController = New System.ServiceProcess.ServiceController()
me.theServiceController.MachineName = "Curious"
me.theServiceController.ServiceName = "CuriousService"

if (theServiceController.Status = ServiceControllerStatus.Stopped) then
theServiceController.Start()
end if
 

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