Microsoft Visual C & C++: Remote COM help

  • jamesbond007 / 202 / Fri, 19 Feb 2010 21:18:00 GMT / Comments (1)
  • Hi guys,

    I have developed a COM server EXE which I'm able to connect to it on the local machine where it reside, however when I try to connect to it on my remote machine it fails. I get a -214732155 error.

    I use CoCreateInstanceEx and I played with all the settings of DCOM config on the server and client and nothing worked.

    Any ideas are really appreciated.

    Thanks
  • Keywords:

    remote, com, microsoft, visual c++, vc

  • http://www.edevs.com/visual-c-c++/72940/«« Last Thread - Next Thread »»
    1. I get a -214732155 error.

      Are you sure you entered this error correctly? It seems to me you missed a digit. Anyway, use Error Lookup to see what it means (Error Lookup is a part of the Visual Studio tools).

      Anyway it's of course important that the COM server is registered on the machine that shall act as a server. If it's not an IDispatch interface you need to register the typelibrary and/or the proxy/stub dll on the client machine.

      The server should call CoInitializeSecurity if you haven't done that already.

      If the two computers aren't a part of the same domain it can be rather painful to get this to work. However, one way to do it is to make sure that the user that wishes to instansiate the COM object on the server has an account on both the client machine and server machine with the same name and the same password. The user obviously needs the correct privilegies.

      About dcomconfg.exe. You should only need to run this on the server machine. In the beginning to get it to work relax all security to the minimum. For instance:

      1. Make sure that Windows firewall (or any other firewall) isn't blocking RPC calls. You can configure what ports DCOM should use under the tab Endpoints.
      2. Set Authentication Level: None
      3. Set Launch and activation permissions: Everyone
      4. Set Access permissions: Everyone
      5. Set Configuration permissions: Everyone
      6. Set Identity : Interactive user. Make sure you are logged in as the same user on the sever as the user on client machine.

      When you've managed to establish a connection you tighten the security one step at a time.

      COM+ intended to lessen this pain by making it easier to register a component and generating a distribution package that can be installed on all clients.

      All in all this can be a bit difficult to get to work but don't give up. It's not impossible. The security error messages are unfortunately not very helpful as they must not leak security info to a potential attacker.

      Hope this helps

      marten_range | Sun, 11 Nov 2007 00:43:12 GMT |