Click here to Skip to main content
13,200,729 members (54,054 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
Hi,

i am trying to open an excel file on the clients pc using asp.net and vb.net.
i have specified
Imports Microsoft.Office.Interop
in the aspx.vb file. and it works fine in the test environment.

but once i host it on the server (MS server 2003) having MS office 2003 installed, it throws an error. and when i check, it shows "microsoft.office.interop doesnt contain any public member or cannot be found"

and when i use a try catch block it throw the below error
Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)). 

Please help me out on this.

thanks
Joe
Posted 27-Oct-11 1:48am
joe_j4.2K
Updated 3-Oct-17 20:47pm
v3
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

Error Message:

Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0×80070005 (E_ACCESSDENIED)).
Solution:

This is a COM permissions problem.

Start > Run > dcomcnfg (or “mmc -32″ and then add the Component Services snap-in manually if you can’t find the app under step 3)
Navigate to Component Services > Computers > My Computer > DCOM Config
Locate the MS application giving you trouble (eg: “Microsoft Excel Application” for Excel or “Microsoft Word 97 – 2003 Document” for Word)
Right click > Properties
On the security tab: Select Customize under Launch and Activation Permissions and click Edit…
Add the account under which the site is running (eg: Network Service) and assign Local Launch & Local Activation permissions
Voila!

Error Message:

[COMException (0x800a03ec): Microsoft Excel cannot access the file '<filename>'. 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.
Solution:

This seems to be an issue with Excel/Word/etc not having access to a profile when being started via the interop route.

Open Windows Explorer
Depending on whether you installed a 32bit or 64bit version of office you will need to do one (or both) of the following:
32bit Office installation: Navigate to C:\Windows\System32\config\systemprofile
64bit Office installation: Navigate to C:\Windows\SysWOW64\config\systemprofile
Verify the folder "Desktop" exists (create it if it's not there)
Right click > Properties
On the security tab: Add the account under which the site is running (eg: Network Service) with default permissions (Read & execute; List folder contents; Read)
Voila!
  Permalink  
Comments
Fayaz7Wonders 24-May-13 3:06am
   
Hi,
Thanks a lot for ur solution.Its working but only when I am logged in to the Server.When I logged out same error when exporting Excel.Do u have any permanent solution for it.
J.Santichai 17-Feb-16 2:52am
   
Well done for this solution :)
id8labs 27-Sep-17 0:44am
   
Hi Wes Aday,
I am having same issue, on my local host when I am running the program exel and word file is creating and downloading properly but when I am publishing the code at server I am getting access denied error.
"Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))."
I searched on so many web sites and tried this
Start > Run > dcomcnfg
Then Component Services > Computers > My Computer > DCOM Config
On my local host I don't have "Microsoft Excel Application and Microsoft Word 97 – 2003 Document" and on my server I have these options. I selected all possible account that is available and gave full permission. Still facing the same problem. I need to add account or what?
Please help me in this. Thanks a lot.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Hi,

i got on how to do this. I had to set NETWORK SERVICES permission on the EXCEL DCOM in the server.

the next issue is, the NETWORK SERVICES locks the excel file the moment it is created and this creates opening, and deleting the excel file impossible.

well i found out that adding
xlapp.quit()
solves the problem of the file being locked.

and its all fine now

thanks anyways
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web02 | 2.8.171020.1 | Last Updated 4 Oct 2017
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100