Fixing COM class factory error 80040154 when using ActiveX controls in .NET Applications
Using the wrong version of the ActiveX controls in your .NET application will cause you to receive the error:
Cause:
The OCX files to be registered for your application are determined by whether your application is a 32-bit or 64-bit application.
32-bit .NET applications must register the x86 OCX files while 64-bit .NET applications must register the x64 OCX files.
The location of the different OCX files are as follows:
x86: The x86 OCX files are located in the 'lib' folder of the installation directory for the ActiveX product.
x64: The x64 OCX files are located in the 'lib64' folder of the installation directory for the ActiveX product.
Registering OCX Files: All of our ActiveX products include batch files for registering and unregistering all of your OCX files. These batch files will be found in the 'lib' and 'lib64' directories and will be named register.bat and unregister.bat.
Batch file Example:
If you wished to register your 32-bit OCX files for IPWorks V8, you would run the register.bat file located at:
Single File Example:
If you instead want to register only a single OCX file, you can instead use the command:
"Retrieving the COM class factory for component with CLSID [ID] failed due to the following error: 80040154."
Cause:
The OCX files to be registered for your application are determined by whether your application is a 32-bit or 64-bit application.
32-bit .NET applications must register the x86 OCX files while 64-bit .NET applications must register the x64 OCX files.
The location of the different OCX files are as follows:
x86: The x86 OCX files are located in the 'lib' folder of the installation directory for the ActiveX product.
x64: The x64 OCX files are located in the 'lib64' folder of the installation directory for the ActiveX product.
Registering OCX Files: All of our ActiveX products include batch files for registering and unregistering all of your OCX files. These batch files will be found in the 'lib' and 'lib64' directories and will be named register.bat and unregister.bat.
Batch file Example:
If you wished to register your 32-bit OCX files for IPWorks V8, you would run the register.bat file located at:
C:\Program Files (x86)\nsoftware\IPWorks V8 ActiveX Edition\lib\register.bat
Single File Example:
If you instead want to register only a single OCX file, you can instead use the command:
regsvr32 ocxfilename
The below command would register the 32-bit version of the HTTP component's OCX file.
regsvr32 "C:\Program Files (x86)\nsoftware\IPWorks V8 ActiveX Edition\lib\http81.ocx"
We appreciate your feedback. If you have any questions, comments, or suggestions about this article please contact our support team at kb@nsoftware.com.