I am trying to restart a windows service (part of the application) from my ASP.NET (.Net 4) application but it fails with the error:
Cannot open <ServiceName> service on computer '.'.
Inner Exception: Access is denied
StackTrace: at System.ServiceProcess.ServiceController.GetServiceHandle(Int32 desiredAccess)
at System.ServiceProcess.ServiceController.Start(String[] args)
at NetClient.AvailabilityConfiguration.StartAvailabilityService(ServiceController serviceName, TimeSpan timeout)
The code is working fine on my development machine (Windoes 7) and test server (Windows 2008 R2) but fails on the production server. The only (and BIG) difference is that UAC is turned ON the production serevr where as it is OFF on the dev and test servers.
I have tried adding an app.manifest file to the web application to get elevated privileges but it does not seem to work. I've configured the app.manifest "requestedExecutionLevel" attribute to "requireAdministrator" but does not seem to have an effect.
Any help will be greatly appreciated.
Thanks Aju