0

I'm trying to debug a problem in a REST API I've built in .Net MVC.

In it, I'm trying to use the Microsoft.Office.Interop.Word library to do document manipulation. My application works just fine on my local development box. But, when I run it on the server (after a publish), it bombs with this message...

Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).

...on the following line:

var application = new Application();

This is where it first instantiates an instance of Interop.Word.Application(), which is the first part of my application that interacts with the Interop.Word library. My research (and common sense) has led me to believe that there is some sort of a dependency that is present on my development machine, but is missing on the target server. I'm essentially trying to figure out what that is. I have found several message boards and articles and what-have-you on this site as well as others that have suggested an array of solutions from messing with DCOM settings (Couldn't find Microsoft Word Document in DCOM Config), to upgrading MS Office on the server. None of that seems to work. I've even seen someone suggest using a third-party component like GemBox. But, having to use a third-party solution doesn't seem necessary seeing as how my application works just fine locally. There has to be something missing on the server... some variation in the environment. This cryptic error is not doing me any favors.

Does anyone have any suggestions... something I'm overlooking or that I can try? Thanks!

Community
  • 1
  • 1
Christine
  • 621
  • 7
  • 21
  • 2
    [The office interop is not supported on asp.net](https://support.microsoft.com/en-us/help/257757/considerations-for-server-side-automation-of-office), if possible consider switching to the [Open XML SDK for Office by Microsoft](https://msdn.microsoft.com/en-us/library/office/bb448854.aspx) which is supported in server enviorments (however only supports the newer `.docx` file format) or some other 3rd party library if you need the older `.doc` file support. – Scott Chamberlain Feb 15 '17 at 17:39
  • I went with the GemBox solution. Truth be told, a former developer had gone that route with another API he had developed for similar reasons. Since the company already forked out for the license, I just used that. – Christine Feb 16 '17 at 17:21
  • Feel free to delete your question or post your solution as an answer and accept it. – Scott Chamberlain Feb 16 '17 at 17:26
  • Why don't you post the answer since you answered it, and I'll accept it? I don't want to delete the question... someone else might come around searching for the same thing. – Christine Feb 16 '17 at 17:51
  • @ScottChamberlain - Why can't you just leave it alone? I obviously researched the issue and couldn't find the answer that this is a duplicate of, so... why do you even care? – Christine Feb 17 '17 at 23:18

0 Answers0