Scenario
There is a windows service installed as Local System on a server Machine 1 . The service has some methods to perform on timely basis.
There is a WCF web service running as Network Service identity on IIS at a different server Machine 2.
The following is a code snippet written in WCF web service of Machine 2 to call the Windows service on Machine 1.
ServiceController service = new ServiceController("Windows Service Name", "Machine 1");
if (service != null)
{
service.ExecuteCommand((int)SimpleServiceCustomCommands.WallCacheRefresh);
}
When ever the above code is executed, there isan exception thrown.
Exception:
Type : System.InvalidOperationException.
Message : Cannot open service name service on computer Machine 1.
Additional Info: Message : Access is denied.
Tried Settings
Configuration 1
- Changing the identity of WCF service to Local System.
- Windows service is Local System
Configuration 2
- WCF service is Network Service
- Windows Service is Local Service
- to the service exe, right click => Security => added network service as a user => and gave all permissions.
Configuration 3
- WCF service is network system.
- windows service is local service
- Run => services.msc => select service => right click => properties => Log on => Allow service to interact with desktop is selected.
Configuration 4
- WCF service is network system.
- windows service is local service
- Run => services.msc => select service => right click => properties => Log on => select this account => added Network Service as a user without password.
Configuration 5
- WCF service is Network Service
- Windows Service is Local Service
- to the service exe, right click => Security => added Machine 2 in the users for access=> and gave all permissions.
None of the above scenarios worked.
Please help out.
Thanking in advance