Starting a window service from a web page

  • Thread starter Thread starter JoNo216
  • Start date Start date
J

JoNo216

Hello, I am tring to create a windows service monitor use asp.net and
vb.net. I cannot seem to be able to start a windows service from a
webpage because I do not have access to the "System.ServiceProcess"
namespace. I also tried to start it as I would a normal program using
the "System.Diagnostics.Process.Start" namespace, but I get an error
message saying that "Cannot start service from the command line or
debugger. A Windows service must first be installed and then started
with the ServerExplorer, Windows Service Administive Tools, or the NET
START command."
I know I could use the webpage to send data to a "master" windows
service and have that open up programs, but I don't want to rely on it
in case it is down. I also don't want to use a windows application
because I want to be able to start and stop services without logging
on to the computer. Is there any way of doing this? Or would I have to
default to doing one of these other solutions?

thanks.
 
Hello, I am tring to create a windows service monitor use asp.net and
vb.net.

You're going to hit lots of permissions problems here.
I cannot seem to be able to start a windows service from a
webpage because I do not have access to the "System.ServiceProcess"
namespace.

Did you add a Reference to the required Assembly? You /won't/ have one
by default in a web application which, I'm guessing, is why you can't
access it. Remember; Imports /doesn't/ get you access to anything you
didn't have before - it only allows you to /type/ less code.
I also tried to start it as I would a normal program using
the "System.Diagnostics.Process.Start" namespace, ....

Quite right. You can't just "run" a Service, it has to be installed and
started via the Service Control Manager.
Is there any way of doing this?

I /think/ you might be able to use the Windows Scripting Host to do this
but the ServiceProcess namespace is the better way.

HTH,
Phill W.
 
Back
Top