开发者

queryinterface for interface failed

I'm using an interoped COM assembly in my 1.1 VB.NET code, and when I try to set a property of the class, I get an INvalidCastException error with the message "QueryInterface for Interface xxx failed". also try to register the com file using regsvr32 and regasm method.. nothing worked returns a error it's not valid .NET assembly... please help me experts

http://www.filefactory.com/file/ca7a55e/n/error.jpg

I have attached error screenshot.. interop.peachwserver.dll is the com object.. Smtpmailer is the project..开发者_高级运维. peachtreeloginsingleton is the class name that inherits login class from com


You cannot get this exception if the server isn't registered. If you think you have registration problems then contact the component vendor or author to find out what the proper procedure looks like. An installer that takes care of it is the norm.

QueryInterface will fail when the type library you used to create the interop library doesn't match the actual installed version of the COM server. A fairly typical case of DLL Hell. A corner case is trying to use the server in a thread. That requires the proxy/stub for the server to be registered. Which is commonly unavailable. The only workaround then is to only call the methods in the thread that the object was created. This scenario too is best verified with the component vendor.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜