Sending message to windows service by web page
        Posted  
        
            by Enriquev
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Enriquev
        
        
        
        Published on 2010-04-29T20:06:38Z
        Indexed on 
            2010/05/04
            19:28 UTC
        
        
        Read the original article
        Hit count: 472
        
Hello,
How could I do this with no access denied problem?
I have a windows service:
protected override void OnCustomCommand(int command)
{
    if (command == 1)
    {
      foreach (Process traceProcess in Process.GetProcessesByName("notepad.exe"))
      {
        traceProcess.Kill();
      }                     
    }
}
when I do this:
ServiceController sc = new ServiceController("ProjectManager");
if (sc != null)
    sc.ExecuteCommand(1);
From a windows forms it works, but not from a web page, I get access denied on sc.ExecuteCommand.
What's the best way for a web page to talk to a service?
© Stack Overflow or respective owner