Unable to open work file with IIS but work fine wh

2019-09-15 00:37发布

问题:

am stuck in very strange issue. What i am doing is opening a file through Miscrosft Office DLL

Microsoft.Office.Interop.Word.Application appWord = new Microsoft.Office.Interop.Word.Application();       
    wordDocument = appWord.Documents.Open("C:\\aa.docx");

enery thing is working fine till i run my application from visual studio, but when i run it through IIS thne wordDocument comming null.

i think it is rights issue but dont know whet to doo. My web site app pool identity is "LocalSystem"

回答1:

Usually there are two issues:

  1. You haven't installed Office on the IIS machine
  2. You have no access to the file specified.

There is another big thing you should consider: Word interop IS NOT RECOMMENDED on an IIS process. See this Microsoft document.