I have developed a windows service that would read doc / docx files and replace values based on database records and convert the replaced document as PDF.
Used Microsoft Office Interop DLL for the conversion. The service is hosted in two different machines ( Win Server 2008 R2 Enterprise - 64 Bit ). I had to
set the Identity as Interactive User in DCOM settings to solve the exception :
Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046}failed due to the following error: 8000401a.
Initially I couldn't not find the DCOM entry for Microsoft Windows Document. So I had to change some settings in the registry following this link. This got me working in one system ( the service working fine). However, in another system, the service threw an exception Attempted to read or write protected memory. This is often an indication that other memory is corrupt on WorkDocument.ClearFormatting() code.
To overcome that I had changed the build properties form "Any CPU" to "x86". The service worked fine for some times but it just started to throw the exception (Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 8000401a) again. I could not figure out when the service starts throwing this exception. If I restart the service it works normal but not for too long.
I know using MS interop is not recommended for services. But i came to know about this issue only after the complete development of the service as I had no problems running the program as windows application on my system for testing purposes.
Tried with google and have even solved the issue but the solution seems to be a temporary one for one server and the other seems to work fine. Kindly guide me to overcome the situation.
Thanks
Related
My web API (c# .net 4.7..), hosted on IIS (Windows 10), in order to run properly, requires a piece of software installed on the PC where the IIS is. This piece of software is written in VB and it needs to be running in order for the web-API to start up properly.
The web API is referencing some VB functionality via interop and COM registered dlls.
In Task-manager, i observe that IIS\worker process instead of referencing my running VB6 process, starts a new instance of the VB software (but not properly - and some variables are not loaded in this second instance - i assume this) hence i get the following error:
Creating an instance of the COM component with CLSID {...} from the IClassFactory failed due to the following error: 800a0005 Exception from HRESULT: 0x800A0005 (CTL_E_ILLEGALFUNCTIONCALL).
I have configured IIS and the app pool identity and authentication so that IIS/worker process is starting as the same user as the VB software is run as (both elevated).
I am not sure on how to force the w3w worker process to see the already running VB exe and prevent it from running a new instance of it.
When I am developing in visual studio 2019, and the web API is run via IIS express, everything works fine.
Thank you
I have developped an asp.net application using microsoft office interop excel on my local machine, everything worked well, an excel file was build.
When I deploy the application on my server and run it, I am getting the following exception :
Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046}
failed due to the following error: 80040154 Class not registered
(Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
I have done some research on forums, I know that it's probably because excel is missing on the server, however I am not able to find an appropriate solution, knowing that install excel on the server is not really possible. And also knowing that I would like to keep interop as my library.
Does anyone have a solution?
First, what ever you are trying to do, try to do it without using Excel (or any Office) interop in ASP.NET. Microsoft strongly discourages it, as it might not work as you expect.
There are plenty possibilities to do this without the 'client application' Excel, for example EPPlus.
Second, the problem with your code is the lack of Office installed or the wrong version of Office (also consider 32- or 64-bit platform versions).
I have a web application that create an access database. When I want to create this database, I add Microsoft.Office.Interpob.access.dao.dll from COM references.
This application work in my pc very well. But when I put this application in the customer server I get this error:
Retrieving the COM class factory for component with CLSID {CD7791B9-43FD-42C5-AE42-8DD2811F0419} failed due to the following error: 80040154
Note that the Microsoft Office Access is not install in customer server. Must I Install this program on this server or can I add some dll to resolve this problem or I have to do anything else?
Thanks.
Check out these links, they might help:
social.msdn.microsoft.com - "Error 80040154 retreiving COM Class factory"
asp.net - "Retrieving COM class factory failed due to the following error: 80040154"
software602.com - "KB987: Error code 80040154. Class not registered"
I know this is a little late for the the original poster, but hopefully this will be useful to others. The correct answer is:
No, you don't need to install Microsoft Office Access on the server.
But, you do need to install the Microsoft Office Access Runtime on the server. From my limited experience it doesn't seem to matter which office runtime - I had the 2013 runtime installed locally but when I installed the runtime on my server it was fine with the 2016 runtime (so both installed the required COM object). In my case I was installing the x64 version.
The Microsoft Office Access Runtime is free from Microsoft.
The Microsoft Access 2013 Runtime can be downloaded from: https://www.microsoft.com/en-gb/download/details.aspx?id=39358
The Microsoft Access 2016 Runtime can be downloaded from https://www.microsoft.com/en-gb/download/details.aspx?id=50040
I have a legacy app that captures signatures. It uses Microsoft.Ink.dll that came from a Windows Tablet SDK. I am maintaining the app on Windows 7 VS 2010 and it runs fine on my box. When I deploy the app to Windows Server 2003 the app fails with the following error:
Exception during StringFormat: Index (zero based) must be greater than or equal to zero and less than the size of the argument list. Datapump error on interface Risk Assessment Signatures: Retrieving the COM class factory for component with CLSID {937C1A34-151D-4610-9CA6-A8CC9BDB5D83} failed due to the following error: 80040154.
Regsvr32 on the dll fails.
I assume that this is because related dll's are missing.
Is there any way to delete the old ink dll and use a more modern dll that I can properly deploy? If not what is the best way to deploy this app?
i have a web service that reads data from excel using Microsoft.Office.Interop.Excel. It works fine on my local machine but when i upload it on a server it gives the following error
Server was unable to process request. ---> Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005.
i googled and tried to follow the suggestion of DCOMCNFG-> component services-> computers-> my computer-> com+ appications but then i dont find the Microsoft excel to change rights.
Office 2003 is installed in server and file i am trying to open is 2003 too.
Please help!!
Thanks
You won't find Excel, you'll have to find the matching CLSID and alter the Activation/Launch permissions.
Standard Disclaimer: Unattended execution of office on the server is not recommended by Microsoft, but a lot of us do it happily (myself included).