Click here to Skip to main content
15,921,577 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Why I am having Access permission Issue on hosting as web application in IIS 5.1?
I am starting a windows service using asp.net with C# 3.5.


I am able to start/stop the service on a remote machine in debug mode. I am running a service using Service Controller Class .

while hosting I am getting the following error:
System.ComponentModel.Win32Exception: Access is denied
Posted
Updated 14-Jul-15 1:36am
v2
Comments
F-ES Sitecore 14-Jul-15 8:02am    
I'm not sure exactly what it is you are doing. If you are trying to programmatically start a remote service then the account your code is running under needs permission to do that. If it is the default anonymous user then it won't, so change the anonymous user account to one that has the required permission.
Richard Deeming 14-Jul-15 8:38am    
If you're using IIS 5.1, that means you're hosting your site on Windows XP.

Client versions of Windows are not meant to be used as a web server, and contain artificial limitations to prevent you from using them to host websites.

Also, Windows XP reached end-of-life in April 2014. Since then, no security vulnerabilities have been patched, which means it's an extremely bad idea to use it for a public-facing server!

1 solution

Probably, because your code is trying to access a hard-coded file or folder that you don't have any permission to use.

So check your code, look for any file access or paths, and check them. Remember, a service doesn't run as you (you aren't logged in when the service starts) so any files it accesses need to be "open" to whatever user it is running under.
 
Share this answer
 
Comments
Alex345098 14-Jul-15 8:57am    
ServiceController service = new ServiceController(serviceName, machineName);
With the above code I am able to start the service in another machine. But it's not working while hosting in IIS.
I am getting issue that cannot start service on Remote Machine. This requires privileges.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900