CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 1999
    Location
    Germany, Hessen
    Posts
    226

    Error starting a service as service ...

    Hi !

    I've created a service with VC++6 using an ATL COM AppWizard Project. The services contains a COM class. This is what a did some times before.

    Everything worked fine when I've started the program from development environment. It also works fine, when I register the program as server and instaniate an object of the COM class. No Problems, the exe-file is started.

    But when trying to start the programm as service the service startup fails. I could trace down the problem to the _Module.RegisterClassObjects() methods that internally calls CoRegisterClassObject() for my COM class. That call fails with an error 0x80004015 (CO_E_WRONG_SERVER_IDENTITY). I can't see the reason why, I even tried to run the service under my account (not the local system), but that won't help either.

    Again, when registering as server and instaniate that class or running the exe file from command line everything works out fine.

    Anybody out there that encovered the same problem or any ideas ???? it's really urgent ...

  2. #2
    Join Date
    Sep 1999
    Location
    Germany, Hessen
    Posts
    226

    Posting a problem sometime helps ... ;)

    Hi there.

    After 20 hours trying to find the soruce of the problem I've found the solution 10 minutes after posting it here;

    Just in case someone else encounters that kind of problem:

    In the String Ressources I've changed the name of the Service to force it to use a registry key different from the exe File name. That different name was also used as the service name, so that is what I expected.

    What iv'e not expected is that this seems to be not allowed I dont know why but I think somewhere in the code the original name used at Project creation is used to register something internally.

  3. #3
    Join Date
    Nov 2012
    Posts
    1

    Re: Error starting a service as service ...

    Hi all,
    I had a similar problem. Just in case it could be helpful for anyone, here is what I found out: The service registers a bunch of COM classes with CoRegisterClassObject(). All registrations worked fine except for one. So I looked for this class in the registry and I saw that there was an AppId registered for this class. So I looked up this AppId and it had an entry "LocalService". The value that was set for "LocalService" was different from my service name. So I changed it to my service's name and suddenly it worked.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured