Click here to Skip to main content
15,905,558 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to create windows service in c# which have special permission,

if other program or user directly try to kill or stop service then message will show "access denied".

some anti virus program use this type approach.
please provide any sample.

What I have tried:

i tried everything but not success
Posted
Comments
[no name] 15-Jun-17 8:23am    
Not really sure, but I think this is more a thing which should be solved by windows policy
F-ES Sitecore 15-Jun-17 8:36am    
People who write viruses and other malicious apps would love to do this too. Thankfully it's not possible.
gautamkhatri428 15-Jun-17 8:39am    
why it is not possible, try to download avira antivirus and try to kill avira services
Richard Deeming 15-Jun-17 10:36am    
It is possible to set an ACL on a service, although there doesn't seem to be a GUI to do it.
Service Security and Access Rights[^]
How do I grant start/stop/restart permissions on a service to an arbitrary user or group on a non-domain-member server? | ServerFault[^]

But I doubt you'd be able to prevent an administrator from stopping the service.

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