Error using COM+ app with ASP.Net
-
I have a COM+ application that I can successfully use from a C# Windows Forms application. I am able to access the COM+ components via both early and late binding. No problem. However, when I try to use the same COM+ app from an ASP.Net (C# code behind) application, I get a run-time error. If I use early binding I get an InvalidCastException for QueryInterface indicating the interface query failed. If I use late binding I get a TargetInvocationException indicating the target does not implement IDispatch. In the case of the early binding test, I've created an interop assembly via VS.Net, set a reference to it, etc. just as in the Windows Forms application. In both cases, I've set aspcompat=true in the aspx page. I've read the (very good) CP article on COM Interop by Aravind Corera as well as Tom Archer's C# (2ndEd) book, Adam Nathan's book on interop and others but I'm clearly missing something here. What am I missing? :confused:
-
I have a COM+ application that I can successfully use from a C# Windows Forms application. I am able to access the COM+ components via both early and late binding. No problem. However, when I try to use the same COM+ app from an ASP.Net (C# code behind) application, I get a run-time error. If I use early binding I get an InvalidCastException for QueryInterface indicating the interface query failed. If I use late binding I get a TargetInvocationException indicating the target does not implement IDispatch. In the case of the early binding test, I've created an interop assembly via VS.Net, set a reference to it, etc. just as in the Windows Forms application. In both cases, I've set aspcompat=true in the aspx page. I've read the (very good) CP article on COM Interop by Aravind Corera as well as Tom Archer's C# (2ndEd) book, Adam Nathan's book on interop and others but I'm clearly missing something here. What am I missing? :confused:
Just after posting, I discovered the problem. :-O I'm posting the solution here in hopes it will help someone else in the future. It turned out to be an authentication issue. Adding the following line to the Web.config file took care of it. (So far...) < identity impersonate="true" /> :) :) :)