August 14, 2016

ATL Service registration failure: CO_E_WRONG_SERVER_IDENTITY

CO_E_WRONG_SERVER_IDENTITY (0x80004015, "The class is configured to run as a security ID different from the caller") returned from a registration function (IRunningObjectTable::Register()) can be the result of the following issues:

  1. Incorrect service registration settings. Find the key named HKEY_CLASSES_ROOT\AppID\{<service_app_GUID>}, delete the value named LocalService (if there is one), and add the value named RunAs (type REG_SZ, value Interactive User).
  2. Wrong service GUID (if you've changed it, which is a bad idea in general). Ensure that the following data ('@' means the default value)

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AppID\{yourServiceGuid}]
    @="yourServiceName"
    

    matches these data:

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AppID\yourServiceName.exe]
    @="yourServiceName.Application"
    "AppId"="{yourServiceGuid}"
    

    Sometimes, the default value can be "(value not set)", but the GUID should match.

  3. Wrong service executable name. Check the registry entry for your service AppID (search in the HKEY_CLASSES_ROOT hive using part of your service executable name):

    HKEY_CLASSES_ROOT\AppID\<executable_name>.EXE
    

    Suppose our service executable is named SomeService100ud.exe but in the registry we see the following entry instead:

    HKEY_CLASSES_ROOT\AppID\SomeService.EXE
    

    In this case, check the registrar script files (.rgs) of your service project. Probably the executable name in these scripts is incorrect.

No comments:

Post a Comment