Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploying website using a COM interface to IIS causes class not registered error

I have an ASP.NET site that needs to use a COM interface that we developed. When I test the website within the visual studio environment, it works fine. However, when I go to deploy the site to IIS, I receive an error stating

Retrieving the COM class factory for component with CLSID {0716BE95-6372-46B2-B42D-9FC0ED5E0FE3} failed due to the following error: 80040154 Class not registered

I've tried a few things

  1. Ensuring that the dll containing the class IS in fact registered. I made sure that the entry in the registry matched the CLSID that the error stated it failed to load.
  2. Unregistering the dll and re-registering it using regsvr32.exe
  3. Following the advice in this question. The class I'm trying to use is not a service though, so I'm not sure how relevant that question is to my issue.
  4. Following the advice in this question. Again, I'm not sure how relevant that is since that question states that it is an access denied error.
  5. Restarting my machine after unregistering and re-registering the dll
  6. Changing the Platform target of my project from Any CPU to x86 as suggested in this answer. This causes another problem. Could not load file or assembly 'TestWebSimpleMath' or one of its dependencies. An attempt was made to load a program with an incorrect format. which I think is a step backwards.

I'm running Windows 7 Ultimate edition 64 bit.

Any help would be great. I've been trying to get this working for nearly 9 hours with no luck.

like image 416
nick Avatar asked May 30 '13 01:05

nick


People also ask

Why does it say Class not registered when I try to open settings?

Class not registered error in Windows is an error that usually occurs when trying to open an app or program in Windows. The error occurs mainly due to unregistered DLL files within the app or program. Sometimes, the file may become unregistered for certain reasons. It may appear in Windows 10, 8, and 7.


1 Answers

Reason:
Your service was built against 'Any CPU' causing you errors on 64bit where you are using COM components. You need to build it for 'x86'.

Solution:
In Visual Studio, right click on the PROJECT then select PROPERTIES. Click the BUILD tab then under PLATFORM TARGET change Any CPU to X86.

Possible duplicate of this question.

Update:Enable 32 bit application

Go to IIS -> Application Pool -> Advance Settings -> Enable 32-bit Applications

check this related question

like image 81
bot Avatar answered Sep 20 '22 22:09

bot