1

We're attempting to interact with an application running on a Windows XP box that provides a COM interface. When the application, which is NOT running as a service, is running as the same Windows user as our test code we're able to instantiate the COM interface and make calls against it without any issues. We're using a simple instantiation:

using ServerLib;
...
ServerLib.ServerObject server = new ServerObject();

However, when we log into the same machine as a different user, and thus the server and application are running under different process spaces, and try to run the same code we get an error that reads:

An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll
Additional information: Retrieving the COM class factory for component with CLSID {BE8BD673-1442-449F-B56D-A7CC00DA1B0E} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).

An entry in the System Event Viewer provides a clue:

The server {BE8BD673-1442-449F-B56D-A7CC00DA1B0E} did not register with DCOM within the required timeout.

The Windows Event log entries also provide some clues, but no answers:

  1. A new process has been created:
        New Process ID: 3168
        Image File Name: C:\BIN\server.exe
        Creator Process ID: 3348
        User Name: USERNAME
        Domain: DOMAIN
        Logon ID: (0x0,0x3E7)

  2. A process was assigned a primary token.
        Assigning Process Information:
        Process ID: 3348
        Image File Name: C:\WINDOWS\system32\winlogon.exe
        User Name: USERNAME
        Domain: DOMAIN
        Logon ID: (0x0,0x3E7)
    New Process Information:
        Process ID: 3168
        Image File Name: C:\BIN\server.exe
        User Name: CallingUser
        Domain: DOMAIN
        Logon ID: (0x0,0x217579E)

  3. A process has exited:
        Process ID: 3168
        Image File Name: C:\BIN\server.exe
        User Name: CallingUser
        Domain: DOMAIN
        Logon ID: (0x0,0x217579E)

We've also tried some alternative instantiation techniques, such as this one to try and attach to the existing process:

ServerLib.ServerObject foo = (ServerLib.ServerObject)System.Runtime.InteropServices.Marshal.GetActiveObject("Server.ServerObject");

This gets the following error:

An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll
Additional information: Operation unavailable (Exception from HRESULT: 0x800401E3 (MK_E_UNAVAILABLE))

We suspect that the issue revolves around the fact that our test code is running under a different login than the code hosting the COM interface. What we don't know is how to set up the configuration to allow us to make this work. The server hosting the COM interface is a singleton and a copy cannot be started up to handle COM requests by our client software.

What steps are necessary to get a client app on the same machine, but under a different process space to instantiate a COM interface and call methods in an .exe file host?

5
  • You are debugging this problem from the wrong end, it is the server that's failing badly. You can only get help from the author or owner of that server. You won't find him here. Sep 22, 2014 at 15:55
  • If the application that provides the COM interface is not running as a service, why is it running in a different user context than your test code? Did you use "switch user" to log in two different users at once? Sep 22, 2014 at 21:16
  • @HansPassant, I don't disagree that the solution best rests on the side of the server component. The problem is that we're forced to deal with the situation at hand, and that involves someone unwilling to make any modifications on their side. So we're left to try and get things working solely from our end. Sep 25, 2014 at 17:34
  • @HarryJohnston, the target environments on which we need to operate do allow for the possibility that the server may have been started under a different user than the user who's running our code. I think we may have a solution available that involves detecting the session ID of the server process that we need to connect with and restarting the child processes with the same user. Sep 25, 2014 at 17:37
  • The issue is likely to be not which user is running the code, but which Remote Desktop session it is running in. If so, then yes, relaunching the client in the appropriate session should resolve it. Sep 25, 2014 at 21:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.