CoRegisterClassObject CO_E_WRONG_SERVER_IDENTITY (0x80004015)

Viewed 149

I am building a out-of-process COM server in .NET 5 using this COM registration class.

The client is a service running as system which I do not control.

With the server set with RunAs = Interactive User (default value in my case) everything works as expected during debugging: the server can register and the client can call the server as an out-of-process COM server.

However in my case the server runs as system (not as a service though) when there is no user logged in. Which of course means that the registration fails when RunAs = Interactive User with error CO_E_WRONG_SERVER_IDENTITY (0x80004015).

I've tried to fix it by setting RunAs to Launching User (by deleting the RunAs value from the registry) and while that allows my process running as system to register successfully, the client cannot seem to connect to the existing COM server and instead it works as an in-process COM server where the COM client creates a new process with the COM server.

I've also tried setting RunAs = NT AUTHORITY\SYSTEM and looking at permissions but in both cases I had the same issue as before.

So how can I register an out-of-process COM server to run as SYSTEM - without being a service - while allowing a COM client that is a service running as SYSTEM to connect to it?

0 Answers
Related