Reference Microsoft.Office.interop.access.dao.dll cause error C# - c#

I have an application which connect to access 2003.
I'm facing a problem with insert bulk of rows to access, so i came to an solution by using DAO (Microsoft.Office.interop.access.dao.dll) to improve performance of this process as follow this link
Retrieving the COM class factory for component with CLSID {XXXX} failed due to the following error: 80040154
But when i open the connect to access by using
using DAO =Microsoft.Office.interop.access.dao.dll;
....
new DAO.DBEngine();
this line gave me an error:
System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {CD7791B9-43FD-42C5-AE42-8DD2811F0419} failed due to the following error: 80040154
My application is 32 bit and i running the program in a machine with Win xp 32 bit too, It work fine until i start using DAO
I have try many thing that i came up when google, but nothing help, like this:
Error in create access database?
--
More info:
After install
AccessDatabaseEngine.exe
the problem go away, so i think it must be something like the dll can't register, and then after install the package, somehow it's registered DAO dll.
But i can't not install anything in production server, so i need a way to manual register the dll, or something like that, to let the application work without install AccessDatabaseEngine.exe package
Please give me any advice

WORKAROUND:
The possible workaround is modify your project's platform from 'Any CPU' to 'X86' (in Project's Properties, Build/Platform's Target)
ROOTCAUSE
The VSS Interop is a managed assembly using 32-bit Framework and the dll contains a 32-bit COM object. If you run this COM dll in 64 bit environment, you will get the error message.

Related

Retrieving the COM class factory for components with CLSID - Class not registered

I am trying to run my Windows Application (winForm) on a PC (OS Win7, 64 Bit) but it showing me this error or exception:
Retrieving the COM class factory for components with CLSID
{00853A19-BD51-419B-9269-2DABE57EB61f} failed due to the following
error: 80040154 Class not registered (Exception from HRESULT:
0x80040154 (REGDB_E_CLASSNOTREG)).
I google and found that I should need to Build for x86 (Althought current window is 64 bit). I did this but getting the same error. After that now I trying to install zkeeper dependency but getting this error:
The Module D:\TheSDK\zkemkeeper.dll" may not compatible with the
version of windows that you are running. Check if the moduel is
compatible with an x86 or x64 version of regsvr32.exe
Here is batch file (Dependency SDK installer) :
cd /d %~dp0
if /i "%PROCESSOR_IDENTIFIER:~0,3%"=="X86" (
echo system is x86
copy .\*.dll %windir%\system32\
regsvr32 %windir%\system32\zkemkeeper.dll
) else (
echo system is x64
copy .\*.dll %windir%\SysWOW64\
regsvr32 %windir%\SysWOW64\zkemkeeper.dll
)
Update: Even I try to run and install manually both regsvr of system32 and 64 and still getting same error.
I don't know what was the problem but maybe it was related to .Net framework. After installing the developer pack of .Net Framework 4.5.2. I deleted my SDK and register all the dependency (DLL) again. Then, it worked.
This error occurs because the com dll Zmkeeper.dll was not able to register. In some cases, it might need to be registered along with a typeLib file. Also, there could perhaps be some custom installer action performed if it goes through an installer. Seems like a demo version installation solved the problem. checkout this issue mentioned here

What has to be done to resolve 80040154 Class not registered execption

I am facing the following error only when i try to run the project on a target machine
[ERROR] ExecuteTestScriptsOnSAP_GUI: Retrieving the COM class factory
for compo nent with CLSID {B90F32AD-859E-4EDD-BFAE-C9216849520C}
failed due to the foll owing error: 80040154 Class not registered
(Exception from HRESULT: 0x8004015 4 (REGDB_E_CLASSNOTREG)).
It seems to work fine on my development machine.
I am trying to launch SAP gui 7.40 from my project and it has a reference to Interop.SAPFEWSELib.dll
The above .dll file was built when sapfewse.ocx was first added as a dependency to the project.
Can anyone please guide me as to what can be done to resolve this issue?
I can't comment yet and so can only respond in an answer.
It could be that that the control sapfewse.ocx that you are consuming via Interop.SAPFEWSELib.dll is not registered on your target machine.
Check the registry HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID and locate the class for B90F32AD-859E-4EDD-BFAE-C9216849520C on your dev machine. The InProcServer32 key should tell you the path of the registered component. Ensure that this component is deployed and registered on your target machine.
Hope that points you in the right direction.
If you're on a 32bit OS machine then
"C:\Windows\System32\regsvr32.exe" /i "Path to OCX"
Or 64 bit then "C:\Windows\SysWOW64\regsvr32.exe"
If you double click the .ocx on the target machine, it should prompt you to select a program to complete the action with. Browse to the relevant regsvr32.exe and it will then register it for you.
But it looks as if your ocx comes from a third party SDK? as it resides in c:\program files (x86)\sap\frontend\sapgui\ on your dev machine. Have you installed this SDK on your target machine? If not.. do so and this will install and register the component for you.

c# PowerPoint Slide interop and office dll registry error

I am in need of read a PPT/X PowerPoint File in C# code and display that in web form as image.
I did it using in VS 2013 C# .NET 4.0 and using dlls, Microsoft.office.interop.powerpoint.dll and Office.DLL.
It is working perfectly fine when running on local machine and working in local machine.
When I publish it on Azure Web Server or in Shared Server IIS,
I am ending up with
*
Error occurred: Retrieving the COM class factory for component with
CLSID {91493441-5A91-11CF-8700-00AA0060263B} failed due to the
following error: 80040154 Class not registered (Exception from
HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
*
I copied both DLLs into BIN folder.
Still no use.
Any idea how can i resolve this!!
Thanks in advance.
Just try enabling the fusion logs, it may be the case that your library is not signed and due to that your are getting this exception. Try disabling the strong name validation using sn -Vr

IIS 64bit Com dll

Hi I'm developing an app where i need to access a com DLL via a web service.
I'm running IIS 7 on win 7 and developing using vs2010.
Everything works fine in the development environment but when I went to publish to IIS on my localhost to do some further testing I was getting the following error:
System.Runtime.InteropServices.COMException: Retrieving the COM class
factory for component with CLSID
{29345FBB-4DE7-4838-9464-5A886B775677} failed due to the following
error: 80040154.
I looked this up and found that If I changed my app pool settings to "Enable 32 Bit Applications" to true. That this would get round the error, I did this and now I am getting the following error:
Unable to cast COM object of type 'ComName.ComClassClass' to interface
type 'ComName._ComClass'. This operation failed because the
QueryInterface call on the COM component for the interface with IID
'{003B251B-6F4E-42A5-8111-11DB41F1D14A}' failed due to the following
error: No such interface supported (Exception from HRESULT: 0x80004002
(E_NOINTERFACE)).
Im completely lost as to where to look, Have googled it an can't seem to find an answer is there anyone that knows what is going on?
COM dlls need to be registered on the IIS server.
Install the software that installs that COM dll or do it yourself manually using regsvr32.exe "C:..\yourdll.dll"
[Window Title]
RegSvr32
[Content]
To register a module, you must provide a binary name.
Usage: regsvr32 [/u] [/s] [/n] [/i[:cmdline]] dllname
/u - Unregister server
/s - Silent; display no message boxes
/i - Call DllInstall passing it an optional [cmdline]; when used with /u calls dll uninstall
/n - do not call DllRegisterServer; this option must be used with /i
If you think it is already registered then unregister it and re-register it, and maybe do a iisreset :)
Example (assuming your dll is directly in C:\ ):
C:>regsvr32.exe /u thecomdll.dll
C:>regsvr32.exe thecomdll.dll

Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY)

I'm creating a windows service on a windows 2003 machine, using dsofile to modify custom properties on a bunch of documents. This works fine until I install the service on a win2k8 machine where it gives me the following error:
ERROR [2010-09-06 13:17:12,317] An
unknown error occured:
System.InvalidCastException: Unable to
cast COM object of type
'DSOFile.OleDocumentPropertiesClass'
to interface type
'DSOFile._OleDocumentProperties'. This
operation failed because the
QueryInterface call on the COM
component for the interface with IID
'{58968145-CF01-4341-995F-2EE093F6ABA3}'
failed due to the following error:
Error loading type library/DLL.
(Exception from HRESULT: 0x80029C4A
(TYPE_E_CANTLOADLIBRARY)).
All my projects are set to run as x86, and Ive used procmon to monitor the files requested without any clues.. Anyone have any ideas on how to solve this?
Since you have mentioned that you are running a service under Win2008,
The first clue is, is the DSO File dll component part of Office, what version? is that installed?
I am not sure if a service can access such a office component running as a system account user which could be open to malicious exploits whilst running under said account as a service...
TYPE_E_CANTLOADLIBRARY should be as a result of the first option given...
I had a similar problem and I solved it due to the explanation by Geoff Darst - MSFT.
I adjusted his original answer to fit your interface IID:
Sounds like you have a problem with your typelib registration.
Presumably, the Com interop layer is hitting the registry to try to
locate the typelib. It would start by looking under
HKCR\Interface{58968145-CF01-4341-995F-2EE093F6ABA3}\Typelib. The
default value should refer to the guid for the typelib that defines
the interface in question: which should be located under the following
key: HKCR\Typelib{what found in the aforementioned Interface key}.
There should be a version subkey and then a 0 subkey, and a win32
subkey under that. The default value of the win32 key should point to
the right typelib.

Categories

Resources