Exception Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005.
RSS
Hi there,
I had created an ASP.Net application that will create excel file. It works fine when I am running it on ASP.Net port but fails when i run it on IIS.
It gives the following error
Exception Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005.
I had gone through other forums and they had mentioned to give rights to Network Services to Microsoft Excel Application in dcomcnfg. I did the same thing but its of no use. It didnt worked out and I got the same error.
Please suggest me another solution.
Regards,
Yogita
Exception Retrieving the COM class factoryCLSID {00024500-0000-0000-C000-000000000046}
If you add a reference to Microsoft Excel and then try to use it within your ASP.NET application you may receive the following error.
Server Error in '/excel' Application.
Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005.
Example Application
The problem is that by default Microsoft Excel as a COM object can only activated by the following accounts:
Administrator
System
Interactive
When you are running your ASP.Net account on Windows XP your web application is running as the ASPNET account.
The way to resolve this issue is to edit the DCOM configuration settings for the Microsoft Excel Application object.
Configure DCOM
Go to the Start-Run menu item.
Type in "DCOMCNFG" and hit enter.
This should load the "Component Services" MMC (you can also load from Administrative Tools - Component Services"
Expand "Component Services"
Expand "Computers"
Expand "My Computer"
Select the "DCOM Config" item
Select the "Microsoft Excel Application" item.
Right click and select Properties
Select the Security Tab and you should see the following:
Under "Launch and Activation Permissions" select the "Customize" option.
Click the "Edit" button
Windows XP
Windows 2003 Server
Click the "Add" button to add a new account to the list.
On the dialog that is displayed click the Locations button
(this is because by default your domain will be selected and we need a local account)
In this dialog scroll the list to the top (sometimes the first item is not visible) but scroll to the top and select the first item which is your computer name. In the list below "CCROWE" is the name of my computer.
Click the OK button
On the dialog that is displayed enter "ASPNET" as the account name (make sure location is set to the name of the computer that IIS is on) on
Windows XP or if you are running on Windows 2003 Server you must enter the account that the
Application Pool is running as, by default "Network Service"
Windows XP
Windows 2003 Server
Note: A quicker way on Windows XP is to just enter the computer name and the account
so in my case that would be:
ccrowe\ASPNET
Click the OK button
Now make sure you select the following options for the "ASP.NET Machine Account" or the account that is the application pool identity ( by default Network Service)
Local Launch : Allow
Remote Launch : [blank]
Local Activation : Allow
Remote Activation : [blank]
These settings can be seen below:
Windows XP
Windows 2003 Server
Click the OK button and test your web application again and it should work fine.
Note: Remember if you are running on Windows 2003 Server you must use the application pool identity as the account and not the ASPNET account.
On Windows Server 2003, IIS 6 , after adding Network Service (the account the application pool is running as) it still did not work. Turns out I had to add the server's "Network" account and give launch permissions. Even though the application pool for the site
is running as Network Service. Adding Everyone worked, but then i weeded through the machine accounts until i found that Network was the one. Just FYI incase someone is having the same problem i was.
I would like to add my 2 cents. After working over a day on this error with no luck I found the solution to my problem. For some strange reason my site is running under NT_AUTHORITY\IUSR. I do not have a reasonable explanation for this since the app pool
is set to run under NetworkService. To discover this I dropped this line of code in, built the site and attached the debugger to the process:
Dim a As String = System.Security.Principal.WindowsIdentity.GetCurrent().Name
I added IUSR using the instructions above and it worked like a charm. Now since I can't be sure what account the site will run under on my client's server I had to use another
work around. We were given a user name and password on our client's domain to use for this sort of thing. This user is a member of the administrators group. I used impersonation just for the block of code I needed. This works since the admin group is given
launch permissions by default.
Then of course I get the "Microsoft Office Excel cannot access the file.." error mentioned above. I added the Desktop folder per the instructions in the link and BINGO! I'm now back in business.
This Error will also occur if you openfile(filename) and application crash without closing file. If this occur a few times, then the Error will show subsequently.
Solution 1: Restart Server
Solution 2: use the try catch. Add closefile(). When crash, catch will close file.
I'm running XP, and using an object name of "ASPNET" but its not being accepted.
Is "ASPNET" related to IIS installation or IIS setting.
Anyone have any idea?
ysingh11
0 Points
1 Post
Exception Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-0000...
Aug 11, 2008 09:47 AM|LINK
Hi there,
I had created an ASP.Net application that will create excel file. It works fine when I am running it on ASP.Net port but fails when i run it on IIS.
It gives the following error
Exception Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005.
I had gone through other forums and they had mentioned to give rights to Network Services to Microsoft Excel Application in dcomcnfg. I did the same thing but its of no use. It didnt worked out and I got the same error.
Please suggest me another solution.
Regards,
Yogita
Exception Retrieving the COM class factory CLSID {00024500-0000-0000-C000-000000000046}
erlis
Member
12 Points
12 Posts
Re: Exception Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-...
Sep 10, 2008 01:59 PM|LINK
Hi Yogita,
Check this out and tell me if you did all these steps:
http://blog.crowe.co.nz/archive/2006/03/02/589.aspx
Erlis
babuji_godem
Member
109 Points
57 Posts
Re: Exception Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-...
Apr 07, 2009 07:55 AM|LINK
If you add a reference to Microsoft Excel and then try to use it within your ASP.NET application you may receive the following error.
Server Error in '/excel' Application.
Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005.
Example Application
The problem is that by default Microsoft Excel as a COM object can only activated by the following accounts:
When you are running your ASP.Net account on Windows XP your web application is running as the ASPNET account.
The way to resolve this issue is to edit the DCOM configuration settings for the Microsoft Excel Application object.
Configure DCOM
Windows XP
Windows 2003 Server
(this is because by default your domain will be selected and we need a local account)
In this dialog scroll the list to the top (sometimes the first item is not visible) but scroll to the top and select the first item which is your computer name. In the list below "CCROWE" is the name of my computer.
Windows XP
Windows 2003 Server
Note: A quicker way on Windows XP is to just enter the computer name and the account
so in my case that would be:
ccrowe\ASPNET
These settings can be seen below:
Windows XP
Windows 2003 Server
Click the OK button and test your web application again and it should work fine.
Note: Remember if you are running on Windows 2003 Server you must use the application pool identity as the account and not the ASPNET account.
Human Logic Pvt Ltd.
SailajaMagan...
Member
2 Points
1 Post
Re: Exception Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-...
May 13, 2009 06:59 PM|LINK
Hi,
I'm getting the below error on windows 2000 server .How do I fix this problem on 2000 server?
Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005.
-Sailaja
sansegot
Member
2 Points
1 Post
Re: Exception Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-...
Jul 07, 2009 09:59 AM|LINK
Fixing the DCOM security problem is not enought to make Office automation work on Windows Server 2008 with IIS7.
The server will report the following error:
Microsoft Office Excel cannot access the file 'c:\temp\test.xls'. There are several possible reasons:
The solution is posted here (look at the text posted by Ogawa user):
http://social.msdn.microsoft.com/Forums/en-US/innovateonoffice/thread/b81a3c4e-62db-488b-af06-44421818ef91?prof=required
sdhint
Member
2 Points
1 Post
Re: Exception Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-...
Jul 08, 2009 02:46 PM|LINK
On Windows Server 2003, IIS 6 , after adding Network Service (the account the application pool is running as) it still did not work. Turns out I had to add the server's "Network" account and give launch permissions. Even though the application pool for the site is running as Network Service. Adding Everyone worked, but then i weeded through the machine accounts until i found that Network was the one. Just FYI incase someone is having the same problem i was.
bhall066
Member
4 Points
8 Posts
Re: Exception Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-...
Aug 20, 2009 09:13 PM|LINK
I would like to add my 2 cents. After working over a day on this error with no luck I found the solution to my problem. For some strange reason my site is running under NT_AUTHORITY\IUSR. I do not have a reasonable explanation for this since the app pool is set to run under NetworkService. To discover this I dropped this line of code in, built the site and attached the debugger to the process:
I added IUSR using the instructions above and it worked like a charm. Now since I can't be sure what account the site will run under on my client's server I had to use another work around. We were given a user name and password on our client's domain to use for this sort of thing. This user is a member of the administrators group. I used impersonation just for the block of code I needed. This works since the admin group is given launch permissions by default.
Then of course I get the "Microsoft Office Excel cannot access the file.." error mentioned above. I added the Desktop folder per the instructions in the link and BINGO! I'm now back in business.
Hopes this helps!
RonChong
Member
2 Points
2 Posts
Re: Exception Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-...
Jul 02, 2010 09:35 AM|LINK
This Error will also occur if you openfile(filename) and application crash without closing file. If this occur a few times, then the Error will show subsequently.
Solution 1: Restart Server
Solution 2: use the try catch. Add closefile(). When crash, catch will close file.
Malvika
Member
2 Points
1 Post
Re: Exception Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-...
Jul 17, 2010 06:27 AM|LINK
Hi,
I'm running XP, and using an object name of "ASPNET" but its not being accepted.
Is "ASPNET" related to IIS installation or IIS setting.
Anyone have any idea?
Thanks,
Malvika Shrivastava
trongthao
Member
4 Points
2 Posts
Re: Exception Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-...
Nov 30, 2010 03:42 AM|LINK
Hello Mr. babuji_godem
Thank you very much for your article,
It run OK on W2k3