Interop.Word Documents.Open is null

asp.net, asp.net-4.0, c#, ms-word, openxml

Solution

If you are still looking for the answer I have found it just a moment ago for my project.

Open DCOM Config Settings:

- Start -> `dcomcnfg.exe`

- Computer

- Local Computer

- Config DCOM

- Search for `Microsoft Word 97-2003 Documents` -> Properties

Tab `Identity`, change from `Launching User` to `Interactive User`

Problem

I am trying to open .docx file and convert to PDF using Interop.Word.Application. It works as console application but If I use the same in my web application it doesn't work. I tried to see the permissions on the folder. I gave 'Network Service' with full control, but still I get object reference not set at word.Documents.Open. Could you please let me know what could be the problem? I am stuck with this error. Please let me know. I appreciate any suggestions. Thank you. ``` Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.Application(); object oMissing = System.Reflection.Missing.Value; word.Visible = false; word.ScreenUpdating = false; string fileName = @"c:\OUTPUT\test.docx"); Document doc = word.Documents.Open(filename, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing); doc.Activate(); ```

Original source

Related problems