Hi, Michael Johnson Sr.,
I think you will still need to impersonate a user that has rights to
start/stop services on the machine (I'm afraid I can't give you the list of
these rights)
Have a look at the following article (the last section in it):
[ Implementing Impersonation in an ASP.NET Application ]
http://support.microsoft.com/default.aspx?kbid=306158
After doing so, you have 2 ways
- using the System.Diagnostics.Process to call "net.exe" and passing it the
appropriate parameters. It's simpler, but not the better way for sure.
- using platform-invoke - you will have to call the following functions:
http://msdn.microsoft.com/library/en-us/dllproc/base/openscmanager.asp
http://msdn.microsoft.com/library/en-us/dllproc/base/openservice.asp
http://msdn.microsoft.com/library/en-us/dllproc/base/startservice.asp
(optionally, if you need to further control the service, i.e. stop it
http://msdn.microsoft.com/library/en-us/dllproc/base/controlservice.asp
http://msdn.microsoft.com/library/en-us/dllproc/base/closeservicehandle.asp
Hope this helps
Martin
Michael Johnson Sr. said:
I am starting and stopping a process using System.Diagnostic.Process.
aspnet_wp is running as system rather than machine (as per machine.config
modification). When the process gets started, it will not respond to tcp
connections. The process is a service that accepts incoming tcp
connections.
Any ideas will be great.