How do I find out why I am getting an EOSError code 5 - Access Denied registering a service?

Larry Hengen picture Larry Hengen · May 1, 2012 · Viewed 12.2k times · Source

I am getting an EOSError code 5 - Access Denied when the TServiceApplication attempts to register the service with the ServiceManager.

I am using XE2 Win7 64 bit. The error occurs for both 32 and 64 bit targets.

I have a datamodule that uses ADO to connect to a database, and the web services server code. All the code is used in a WinUI project which works. I also have an untested ISAPI DLL based on the same core code.

This is the first time I have tried incorporating a Web Services Server into an NT Service.

I have traced the VCL code that produces the error at line 1027 of Vcl.SvcMgr but I don't know why I am getting the Access Denied error. I have written other NT Services that connect to the database through ADO and have not encountered such an error (although written with XE).

Any pointers would be appreciated.

Answer

Remy Lebeau picture Remy Lebeau · May 1, 2012

You are likely encountering a UAC permissions issue that expects you to run the service install process in an elevated state, such as from a cmd.exe instance that was launched via the "Run as administrator" option, but you are not actually doing so. If you are having this problem with only some services and not others, then the affected services likely do not contain a UAC manifest but contain characteristics that are triggering UAC's Installer Detection feature, typically (but not restricted to) having reserved keywords in your service's filename or version resource.