Cannot pass COM object of type "..." to interface type "..." when using ExeCOMServer

I am using this exe com server:

https://cfx.svn.codeplex.com/svn/Visual%20Studio%202008/CSExeCOMServer/ExeCOMServer.cs

  • my prog - com application
  • The my com method, which takes another com object, void Init(AppsScriptRunningContext rc);
  • in this method I am trying to read a property and get this error

Cannot start COM object of type 'AppsScriptLib.AppsScriptRunningContextClass' for interface type' AppsScriptLib.IAppsScriptRunningContext. This operation failed because the call to QueryInterface for the COM component for the interface with IID '{4D2E5723-87C2-49C1-AA28-ED2D88275100}' failed due to the following error: this interface is not supported (exception from HRESULT: 0x80004002 (E_NOINTERFACE) )

If my application is not a com server, but a regular com application, there is no error. That is why I think the error occurs on exe com server.

https://cfx.svn.codeplex.com/svn/Visual%20Studio%202008/CSExeCOMServer/ExeCOMServer.cs

Regards, Chris

+3
source share
2 answers

This is a very unfortunate sample of code; the chances of success are very close to zero. This is a product of the MSDN Forum Support Group, and their work is not tested by experts at Microsoft. One team member later confirmed that this is not the right way to do this.

The problem with this code is that it completely ignores the note in the MSDN documentation for the RegistrationServices.RegisterTypeForComClients () method:

, CoRegisterClassObject CoDisconnectObject COM .

, , . , COM- . , , , , RPC. , , .

.NET , . , . COM , . , , COM IDL midl.exe. C, , DLL. DLL HKCR\Interface, COM DLL , . , IDispatch , OLE Automation. . , HKCR\Interface, COM .

, . midl.exe, DLL /, . , , E_NOINTERFACE , . , crappy .

.NET COM- - COM+. System.EnterpriseServices.ServicedComponent . MSDN .

+7

, !

( "Program.cs" ) [STAThread] [MTAThread].

+1

All Articles