Starting Windows Service from ASP.NET

  • Thread starter Thread starter Evgeny Cherny
  • Start date Start date
E

Evgeny Cherny

Hi,

I need to start some Windows Service from ASP.NET.
I use Process class of Framework.

/***************************************************/
System.Diagnostics.Process p=new System.Diagnostics.Process();
p.StartInfo.FileName="NET"; // Run NET command
p.StartInfo.Arguments="START MyService"; //Parameters
p.StartInfo.UseShellExecute=false;
p.StartInfo.RedirectStandardError=true;
p.Start();
string errstream=p.StandardError.ReadToEnd(); // Catch the output of process
p.WaitForExit();
/***************************************************/

After running this code errstream contains:
System error 5 occured
Access denied.

This behavior I get only when I try to start service - other NET commands
like HELP for example executed correctly.

I granted permission of administrator to ASPNET account, but It did't help.

What is a problem?
 
Back
Top