Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET VB.NET
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 2:48am
joe_j4K
Edited 11-Oct-12 4:46am
v3
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
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 ''. 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 at 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.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

i am using Microsoft.Office.Interop.Outlook. i followed all the steps as you mention above but i don't get any success.
following are the server information:
IIS 7
Windows 2008 server.
i am receiving the following error:
 
Server Error in '/' Application.
Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005.
Source Error:
Line 19:     protected void btnCalender2_Click(object sender, EventArgs e)
Line 20:     {
Line 21:         _Application olApp = (_Application)new Application();
Line 22:         NameSpace mapiNS = olApp.GetNamespace("MAPI");
Line 23:
  Permalink  
v2
Comments
Wes Aday at 11-Oct-12 9:17am
   
This is not an answer to this year old question that has been already answered. If you have your own question to ask then ask your own quesiton seperately and not as an answer to another question.
Fayaz7Wonders at 24-May-13 3:14am
   
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.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 6

try the steps here they are helpful...
  Permalink  

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

  Print Answers RSS
0 Maciej Los 315
1 OriginalGriff 273
2 Aajmot Sk 224
3 Marcin Kozub 210
4 Richard MacCutchan 200
0 OriginalGriff 7,853
1 Sergey Alexandrovich Kryukov 7,107
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,790


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 27 Jan 2014
Copyright © CodeProject, 1999-2014
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