Tarek Saied
Tarek Saied

Reputation: 6616

how to run windows service as admin

in my windows service i can not create file in onStart method give me an error

error In onstart method Access to the path 'C:\Program Files (x86)\Common Files\xxx\BridgeServiceLog.txt' is denied.

now how i can run my service as admin by code

Upvotes: 0

Views: 3544

Answers (1)

Frazell Thomas
Frazell Thomas

Reputation: 6111

You can't elevate your own process. Additionally, since a service isn't intended to interact with the desktop a user wouldn't be shown any notices you prompt. You would need to adjust the user account your service is executed under.

enter image description here

Upvotes: 1

Related Questions