Click here to Skip to main content
15,895,084 members
Please Sign up or sign in to vote.
2.00/5 (2 votes)
See more:
Hi all,
I need to access word document from my local C drive how to access it from server that from iis? i tried but getting the below 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...
C#
Application wordApp = new Application();

           wordApp.Visible = true;


thanks in advance
Posted
Updated 20-Aug-13 1:38am
v3
Comments
[no name] 20-Aug-13 7:17am    
"Access is denied" is a pretty obvious error message is it not?
Member 9762654 20-Aug-13 7:18am    
yes
Sergey Alexandrovich Kryukov 20-Aug-13 15:47pm    
But what to do with that? Please see my answer.
—SA
ZurdoDev 20-Aug-13 7:19am    
You need to click on Improve question and add relevant code. If you want to get a file from IIS you just need the url.
Status BreakPoint 20-Aug-13 9:32am    
You shouldn't do this. The server side automation of Office is not supported. http://support.microsoft.com/kb/257757/en-us

1 solution

You could run into different kinds of problem if you use Microsoft Office Interop for Word or other applications. This Microsoft article explains why using it in the server setting is discouraged:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q257757#kb2[^].

I suggest you use the alternative approach: Microsoft Open XML SDK:
http://www.microsoft.com/en-us/download/details.aspx?id=30425[^].

This way, you can support new XML-based Office formats (such as .DOCX, .XLSX), ECMA-376 standard:
http://en.wikipedia.org/wiki/Microsoft_Office_XML_formats[^],
http://en.wikipedia.org/wiki/Office_Open_XML[^].

This way, you can work without Office installed. Also, the documents are supported by 3rd-party software. Please see my past answers:
Convert Office-Documents to PDF without interop[^],
Need a rather unique WPF text editor control[^],
Hi how can i display word file in windows application using c#.net[^],
Read a word file without using Interop.word dll...Do not want to install word in IIS..[^].

This is another option: http://npoi.codeplex.com/[^].

—SA
 
Share this answer
 
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


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900