Error when initializing Microsoft Excel interop (64-bit) - c#

I have a website using asp.net with Excel 2010 Interop 64-bit (Microsoft.Office.Interop.Excel.dll).
I deployed code to the Windows Server 64 bit.
By using command:
xelApp = new Microsoft.Office.Interop.Excel.Application();
I see there is no error on this own server.
But from the other computer (same domain), sometimes (not always), I got the error:
System.Runtime.InteropServices.COMException (0x8000401A): Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 8000401a.
How could I fix this issue?
By install the Office 2010 64-bit to server 64-bit, I cannot see the Excel in DCOM config.
Please advise.
Thanks.

Check the folowing:
Is Microsoft Office Installed on the server? If not, you may install the MS Office and this feature should be working.
If you do not want to install the MS Office, you can use a similar tool, which is ClosedXML - 1 https://closedxml.codeplex.com/
I recommend to replace the Interop Excel with the ClosedXML.

That error code occurs due to security issues like insufficient privelage or due to incorrect username, password.

Related

Error: 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine'

I am receiving the above mentioned error wile trying to maintain a connection to Excel work book in asp.net page.
I have installed:
1. 64-bit version of the 'Microsoft Access Database Engine 2010 Redistributable'
But the error still persists. I am using Windows 10, Office 16 (Excel file saved to older compatible version).
Try installing MS Access database engine 2007 instead.

Running an ASP.NET application that uses Excel on a Windows Server

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).

Microsoft Interop Excel. COM Exception with Windows Server 2003

I deployed a VS.Net 2003 web application on Windows Server 2003 where Microsoft Office is not installed. Everything works except Excel report functionality. It's fine in my development PC where I have MS office. The exception is:
COM object with CLSID {00024500-0000-0000-C000-000000000046} is either
not valid or not registered.
Is there a way to get around this error without MS Office installation on the server? Any Office run-time components to fix this issue?
No, the COM Interop interacts directly with components of Excel. The only run-time components I know of are the Interop ones that let you use an installed copy of Excel.

Error in create access database?

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

error when opening excel file

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).

Categories

Resources