STEP 1 :
I’ve just started working on a new project for which we had to
dig out one of our older libraries. We wrote it to retrieve data from MS Excel
workbooks using the Office interop assemblies, and thus far it has never given
us issues. A slight change this time round was that we were using our library
in an ASP.NET site rather than a desktop application. As a result I was faced
with two errors that we’d never seen before.
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.
1. 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)
2. Navigate
to Component Services > Computers > My Computer > DCOM Config
3. Locate
the MS application giving you trouble (eg: “Microsoft Excel Application” for
Excel or “Microsoft Word 97 – 2003 Document” for Word)
4. Right
click > Properties
5. On the
security tab: Select Customize under Launch and Activation Permissions and
click Edit…
6. Add the
account under which the site is running (eg: Network Service) and assign Local
Launch & Local Activation permissions
7. 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.
1. Open
Windows Explorer
2. Depending
on whether you installed a 32bit or 64bit version of office you will need to do
one (or both) of the following:
A. 32bit
Office installation: Navigate to C:\Windows\System32\config\systemprofile
B. 64bit
Office installation: Navigate to C:\Windows\SysWOW64\config\systemprofile
3. Verify
the folder “Desktop” exists (create it if it’s not there)
4. Right
click > Properties
5. 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)
6. Voila!
To reinstall .Net Version on server (Not needed on most cases)
C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe
-i
Cannot find Microsoft Word Application
in DCOM
On 64 bit system with 32 bit Office try this:
1. Start
2. Run
3. mmc -32
4. File
5. Add Remove Snap-in
6. Component Services
7. Add
8. OK
9. Console Root
10. Component Services
11. Computers
12. My Computer
13. DCOM Config
14. Microsoft Excel Application
if error System.Runtime.InteropServices.COMException
(0x800706BE): The remote procedure call failed. (Exception from HRESULT:
0x800706BE)
then check.
http://support.microsoft.com/kb/2461206
Other Solutions
1: you must change the identity of word component in windows\System32\comexp.msc
to be interactive user instead of launching user.
2:
0. Set the DCOM Config Setting for "Microsoft Office Word 97 - 2003 Document"
(Open the properties > Identity Tab > Select "The interative User" Secutiry Tab > Lanuch and Acctivation Permissions > Add Network Serivce
- Save the settings
- Open your Virtual directory in IIS
- Select the Virtual directory
- Select "Authentication".
- Edit anonymous authentication
- Dialog box will get opened > click on set > admin user (any admin user is good)