27

I am using an excel object (COM component) for excel manipulation. It works fine on my PC, but when I deploy the application to our Intranet I am getting this error:

Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005

I am using windows authentication and impersonate=true in my web.config.

I made all the settings in component service but it still gives the same error.

Please help

Jeff Atwood
  • 63,320
  • 48
  • 150
  • 153
Xyz
  • 383
  • 3
  • 10
  • 18
  • 1
    did you find a working solution with this question? I just hit this question with the same problem. I'm running a VB.Net app, **not** Asp.Net. – Yanick Rochon Feb 16 '11 at 18:45
  • never mind, I had to install the .Net functionality of Excel from the Office installer. Silly me – Yanick Rochon Feb 16 '11 at 19:01

11 Answers11

25

I had the same error when I deployed my app. I've got solution from this site: Component with CLSID XXX failed due to the following error: 80070005 Access is denied

Here is this solution:

  1. In DCOMCNFG, right click on the My Computer and select properties.

  2. Choose the COM Securities tab.

  3. In Access Permissions, click Edit Defaults and add Network Service to it and give it Allow local access permission. Do the same for < Machine_name >\Users.

  4. In Launch and Activation Permissions, click Edit Defaults and add Network Service to it and give it Local launch and Local Activation permission. Do the same for < Machine_name >\Users.

*I used forms authentication.

Bruno Bieri
  • 9,724
  • 11
  • 63
  • 92
Monic
  • 726
  • 10
  • 31
  • I can't remember which version of system I had. Did you try this solution? – Monic May 08 '15 at 13:34
  • This worked for me, after searching a solution for about 10 hours. The other solutions mention specific programs to change the permissions for, or to change the binary (dll) builds. This mentions the root (My Computer) and correct 'user's. +1. – Ganesh Jadhav Nov 28 '16 at 06:43
  • Adding permissions to all components is a security risk. It's preferred to give permissions only to the specific component that needs them – ciencia Jan 14 '20 at 10:56
6

This did the trick for me: (solution from the msdn forum)

goto Controlpanel --> Administrative tools-->Component Services -->computers --> myComputer -->DCOM Config --> Microsoft Excel Application.

right click to get properties dialog. Goto Security tab and customize permissions accordingly.

In Launch and Application Permissions, select Customize, Edit. Add the user / group that calls the application.

Community
  • 1
  • 1
bubbassauro
  • 3,969
  • 2
  • 45
  • 45
5

There's one more issue you might need to address if you are using the Windows 2008 Server with IIS7. The server might report the following error:

Microsoft Office Excel cannot access the file 'c:\temp\test.xls'. There are several possible reasons:

  • The file name or path does not exist.
  • The file is being used by another program.
  • The workbook you are trying to save has the same name as a currently open workbook.

The solution is posted here (look for the text posted by user Ogawa): http://social.msdn.microsoft.com/Forums/en-US/innovateonoffice/thread/b81a3c4e-62db-488b-af06-44421818ef91?prof=required

  • 1
    +1000 for server 2008 x64 add folder `C:\Windows\SysWOW64\config\systemprofile\Desktop` bingo!!! – dotjoe Sep 13 '11 at 14:41
4

You will also get this error when there are stale EXCEL.EXE processes in the system (Use Task Manager --> Processes tab to view these.)

Kill all those instances and the application would work normally.

Stephan
  • 41,764
  • 65
  • 238
  • 329
Ravi Kiran
  • 49
  • 1
2

In case it helps somebody:

I am running Windows 7 64-bit and I wanted to register a 32-bit dll.

First I tried: regsvr32 <path\name.dll> and got the following error:

System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {A1D59B81-C868-4F66-B58F-AC94A4A7982E} failed due to the following error: 80040154.

Then I tried to add the application through the Component Services (Run->DCCOMCNFG) and got the following error:

System.UnauthorizedAccessException: Retrieving the COM class factory for component with CLSID {A1D59B81-C868-4F66-B58F-AC94A4A7982E} failed due to the following error: 80070005.

There are many links to solving it but what worked for me was: Console Root -> Component Services -> Computers -> My Computer -> COM+ Applications -> your_application_name -> Properties: Security tab: Authorization: Uncheck 'Enforce access checks for this application'.

I don't know what it does.

ChrisF
  • 134,786
  • 31
  • 255
  • 325
iguigova
  • 21
  • 1
2

I have Done the Following Things in IIS 8.5 (Windows Server 2012 R2)Server and its Worked in My Case Without Restart:

  1. Selecting The Application Pool That Connected to The Application in IIS

  2. And Right Click --> Advanced Settings --> Process Model --> Select Local System Instead of Recommended ApplicationPoolIdentity

  3. And Make Sure C:\Windows\SysWOW64\config\systemprofile\desktop Have Enough Access For Users.

  4. Refresh the Website Link that Connected With this Pool


enter image description here

  • 1
    You're giving [high privileges](https://learn.microsoft.com/en-us/windows/win32/services/localsystem-account) to an application pool. Your server can be hacked easily. – ciencia Jan 14 '20 at 11:00
1

I can understand your pain. In my case the error got resolved by performing below steps:

  1. Start > Run > dcomcnfg.
  2. Open the folder DCOM Config and Select Component Services > Computers > My Computer > DCOM Config.
  3. Select “Microsoft Office Word 97 – 2003 document”/”Microsoft Excel Application” and go to its properties.
  4. In "Security" tab set “Launch and Activation Permissions” need to be Customize (Authorized user).
  5. Now go to IIS and select application pool of the Web and go to its Advanced Settings and select “NETWORK SERVICE” as identity user.

Hope this helps.

Ravindra
  • 210
  • 3
  • 13
1

I'm getting this same error when trying to export a csv file from Act! to Excel. One workaround I found was to run Act! as an administrator.

That tells me this is probably some sort of permission issue but none of the previous answers here solved the problem. I tried running DCOMCNFG and changing the permissions on the whole computer, and I also tried to just change permissions on the Excel component but it's not listed in DCOMCNFG on my Windows 10 Pro PC.

Maybe this workaround will help someone until a better solution is found.

Russell G
  • 470
  • 6
  • 16
0

The CLSID you describe is for the Microsoft.Office.Interop.Excel.ApplicationClass. This class basically launches excel.exe through InprocServer32. If you don't have it installed then it will return the error message you received above.

  • Yes, Excel is not installed on the server machine. Is there any other way to use Interop without installing excel on the server machine. I am asking this because I cannot have access to install any other software on the server machine. – Umer Farooq Jan 11 '17 at 08:36
  • I don't think there is. Excel.exe is kind of like the engine. You might be able to develop Web Service on another computer (that has Excel) then call that web service from the server to process the request and send back the result. This would require strong Windows and .NET programming skills. There are also third-party libraries out there to manipulate Excel documents. –  Jan 11 '17 at 15:05
  • @UmerFarooq How to simple Web Service https://support.microsoft.com/en-us/kb/308359 . Returning large data in Web Service https://msdn.microsoft.com/en-us/library/aa528822.aspx . –  Jan 11 '17 at 21:02
0

For IIS 8 I did basically the same thing as Monic. Im running my application as its own app pool on an x64 machine 1.In DCOMCNFG, right click on the My Computer and select properties.

2.Choose the COM Securities tab.

3.In Access Permissions, click Edit Defaults and add iis apppool\myapp to it and give it Allow local access permission. Do the same for iis apppool\myapp

4.In launch and Activation Permissions, click Edit Defaults and add iis apppool\myapp to it and give it Local launch and Local Activation permission. Do the same for iis apppool\myapp.

additionally I had to make the folders outlined under C:\Windows\SysWOW64\config\systemprofile\Desktop and give read \ write permissions to iis apppool\myapp also

Himilou
  • 127
  • 10
0

If you run the app from the Task Scheduler, it helps to check option in General parameters "Run with highest privileges".

Dariusz
  • 11
  • 4