March 30th, 2004, 08:47 AM
Error starting a service as service ...
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 ...
March 30th, 2004, 09:15 AM
Posting a problem sometime helps ... ;)
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.
November 21st, 2012, 11:21 AM
Re: Error starting a service as service ...
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.
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!