COM Interop - Error calling COM method from ASP.NET 2.0 Web Application RRS feed

  • Question

  • Hello,
              I have a custom COM(VC++) dll which I need to use in a C#.NET project. I have created a RCW for
    that COM dll. In a .NET Windows Application (after adding a reference to the RCW), I am able to create a
    object of that type and successfully call a method on that object. However when I call a method on the RCW in a .NET Web Application or a Web Service Application, I get an error (Unable to cast COM object of interface type..This operation failed because the QueryInterface call on the COM component for the interface with IID '{07388321-0E7D-11D1-A1AD-00A024E2CDFE}' failed due to the following error: No such interface supported). Based on the text displayed in the Output window, it appears that the Web Application is not loading the RCW or the original COM dll. The Windows Application does load both the RCW and the original COM dll into memory. I am using Microsoft .NET Framework Version 2.0, Windows XP and IIS 5.1 (local). Where does IIS look for that dll?

    I would really appreciate it if anybody has any suggestions regarding potential solutions to this issue.

    Thanks in advance,

    Wednesday, July 16, 2008 1:29 AM


  • No, that's a pretty normal COM error produced by QI, I doubt you have a problem with it being able to find the required binaries.  It is traditionally a versioning problem, running with an older version of the component and the IIDs have changed.  Or it can be a multi-threading problem, calling QI from another thread and the interface doesn't have a proxy.  ASP.NET uses threads heavily so the latter would be a good fit.  Please use to ask ASP.NET questions.
    Hans Passant.
    • Marked as answer by Zhi-Xin Ye Tuesday, July 22, 2008 3:41 AM
    Wednesday, July 16, 2008 12:48 PM