Error 5 : Access Denied when starting windows service

前端 未结 30 2365
滥情空心
滥情空心 2020-12-04 18:49

I\'m getting this error when I try to start a windows service I\'ve created in C#:

\"alt

My Code

相关标签:
30条回答
  • 2020-12-04 19:05

    In my case, I had to add 'Authenticated Users' in the list of 'Group or User Names' in the folder where the executable was installed.

    0 讨论(0)
  • 2020-12-04 19:06

    I was getting this error because I misread the accepted answer from here: Create Windows service from executable.

    sc.exe create <new_service_name> binPath= "<path_to_the_service_executable>"
    

    For <path_to_service_executable>, I was using the path of the executable's folder, e.g. C:\Folder.

    It needs to be the path of the executable, e.g. C:\Folder\Executable.exe.

    0 讨论(0)
  • 2020-12-04 19:07

    I also got the same error , It resolved by Right click on Service > Properties >Log On > log on as : Local System Account.

    0 讨论(0)
  • 2020-12-04 19:08

    For me - the folder from which the service was to run, and the files in it, were encrypted using the Windows "Encrypt" option. Removing that and - voila!

    0 讨论(0)
  • 2020-12-04 19:09

    In my case following was not checked.

    0 讨论(0)
  • 2020-12-04 19:10

    Make sure the Path to executable points to an actual executable (Right click service -> Properties -> General tab). Via powershell (and sc.exe) you can install a service without pointing to an actual executable... ahem.

    0 讨论(0)
提交回复
热议问题