0
votes

I need to reference a Com DLL from within a Silverlight program. Since this is not allowed, I created a wcf service and put my reference to the Com in it. This idea seems to work fine when I ran my wcf service from my local machine but when I publish the service to my server it failed to work. The error was “Object reference not set to an instance of an object” where I tried to instance the DLL. Here problem line is m_cloVB6Encryption = New VB6Encryption.cEncryption

VB6Encryption is a complicated one. It called another DLL which calls several others.

To try to isolate the problem I created a very simple VB6 component, this time I got the error "Retrieving the COM class factory for component with CLSID {74FE605A-5861-41A0-BA13-27DDD9C2EBB8} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))."

This is despite the fact that I manually registered the component and it was successful.

The problem line was cloSimple = New Simple.cSimple.

My computer runs Windows 7; the server runs Windows Server 2012 R2 Standard.

1

1 Answers

0
votes

Presumably your COM component was build as 32bit...so when you register it is registered as a (InProc) 32bit COM component....(and can only be loaded by a 32bit application).

Your ASP.NET Website is most likely running in an AppPool that is set to be 64bit...thus it can't use the 32bit COM class.

There are 2 options (the clearest and easiest is option 1):

1) Get your IIS WebSite/Application to run as 32bit, so it can access your already registered 32bit COM component.

To make sure your website is running as 32bit too (instead of as 64bit)...change the DefaultAppPool to enable 32bit applications (or you can create a new AppPool which is 32bit specifically for that webservice/site and make it use it...if you don't want to affect other sites).

OR

2) Do some additional registration so that your COM class is available to 64bit clients too (you register it so it is run OUT OF PROCESS...so it can be consumed by either 32bit or 64bit clients....but you might not want that for perf reasons...and it might not always be possible)