3
votes

Can anybody tell how to debug the Com Dll in IIS 7.0 using VB 6.0 in Windows Server 2008 R2. I am able to hit break point in VB 6.0 accessed from Console Application using interop dlll.Through ASPX pages in IIS 7.0 I am getting the following Exception

Unable to cast COM object of type 'XCreateUser.XAcctUserProfileClass' to interface type 'XCreateUser._XAcctUserProfile'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{7A48FABA-CCC8-4FA6-94E8-803F6CF121F2}' failed due to the following error: Error loading type library/DLL. (Exception from HRESULT: 0x80029C4A

Already DLL built and registered and com interop dll generated.

Please somebody show some light on this

2

2 Answers

2
votes

Already DLL built and registered

"Registered" is the problem here, it wasn't correctly registered. This is an exception message that's generated by the CLR when it tries to locate the proxy for a .NET component that is [ComVisible]. A proxy is required to make a call to a COM component from a worker thread that doesn't do anything to help make the call thread-safe. A thread that's in the MTA, usually a thread-pool thread.

A .NET component is registered with Regasm.exe. You forgot to use the /tlb argument.

Should be simple to fix. If you still have trouble then SysInternals' Process Monitor is the weapon of choice.

1
votes

I generally debug these things as you say through a console or windows forms application. You can always add logging to your web app to see what parameters are being passed to it.

Generally errors like the above are setup issues when running on a 64 bit platform and when utilizing 32 bit dlls. One thing to make sure of is that your application pool allows 32 bit applications. In IIS Manager right click on the application pool your website is running under and go to Advanced Settings->Enable 32 bit Applications. Set that to True.

You'll also need to make sure that your 32 bit dll is registered in the 32 bit registry hive. C:\Windows\syswow64\regsvr32 is the version you'll need to use to register this dll.