Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
968 views
in Technique[技术] by (71.8m points)

asp.net - COM Exception - TYPE_E_CANTLOADLIBRARY?

I am using a COM dll in my .Net web application. This works fine on multiple different machines.
However on one particular machine I get the following error:

Unable to cast COM object of type 'CServer.CApplicationClass' to interface type 'CServer.ICApplication'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{CF0DFA28-046B-4C7D-8AA9-F4B7477D8CAE} ' failed due to the following error: Error loading type library/DLL. (Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY)).

I have registerd the dll using the regsvr32 command.
I have also created a COM+ application for this dll. Running a search through the registry
I can find the key in numerous places. I have also tried unregistering the dll and deleting all referneces on the computer to this dll. And afterwards re-adding the dll and re-registering it.

I have written a simple windows script file which tests the dll. This works fine. However the problem exists in my .net project which is running in iis.

Can anyone help me with this?..

If you need anymore info please leave a comment. Thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I had a similar problem, with the "TYPE_E_CANTLOADLIBRARY" message.

Background: I had a project which used Interop.ReferenceA.dll. This file was created using tlbimp ReferenceA.dll /out: Interop.ReferenceA.dll.

Solution: When I took a look at ReferenceA.dll using RegDllView I noticed that ReferenceA.dll had a subclass, which was the IID shown in the error message. I looked around in the source code of the subclass and noticed that it had a dependency to Interop.ReferenceB.dll.

Turns out that the subclass needed Interop.ReferenceB as a type-library to work. So I ran this:

regasm /tlb:Interop.ReferenceB.tlb Interop.ReferenceB.dll (the 32-bit version of regasm was used.)

And the error went away.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...