Sending message to windows service by web page
- by Enriquev
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?