Office Interop Issue on Windows Server - c#

I am trying to access the Word Office Interop on a server from my aplication using the following line:
Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.Application();
This however causes an exception to be throw:
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 (E_ACCESSDENIED)).
Does anyone know what I can do to allow my program to access this?

You need to grant permission to 'Launch and Activate' for the user running IIS.
Start-->Run-->dcomcnfg
Under Component Services\Computers Right-Click 'My Computer'
Permissions are under COM Security

Related

Microsoft.Office.Interop.Word Retrieving the COM class factory for component with CLSID failed due to the following error: Access is denied

While trying to create a Instance of new Microsoft.Office.Interop.Word.Application I am getting error as below.
try
{
Console.WriteLine("Begin.");
Application wordApp = new Microsoft.Office.Interop.Word.Application { Visible = false };
Console.ReadLine();
}
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
(E_ACCESSDENIED)).
I have tried the solutions suggested in Microsoft Office Interop Error also noticed StackOverflow question with no ans's.
I have Installed the Primary Interop Assemblies Redistributable and Visual Studio 2010 Tools for Office Runtime (vstor_redist).

Outlook in ASP.NET C#

I am trying to get my ASP.NET website,hosted in IIS on a local server, to send a Outlook appointment item. However, I have encountered this error. I have tried the solutions provided by others online, but it still does not work.
Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
Exception Details: System.UnauthorizedAccessException: Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
This is the line that was highlighted:
Line 152: Outlook.Application outlookApp = new Outlook.Application();
Any form of help is much appreciated. Thanks.

Retrieving the COM class factory for component with CLSID {...} failed due to the following error: 80070005 Access is denied

I'm using https://www.npmjs.com/package/node-msoffice-pdf to convert a word to a pdf. This solution works perfectly on my computer.
I updated my app in IIS and I get this error when calling the web service that converts the docx to pdf:
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 (E_ACCESSDENIED)).
I have tried several answers and tutorials step by step such as:
Accessing Office Word object model through asp.net results in "failed due to the following error: 80070005 Access is denied."
Retrieving the COM class factory for component with CLSID failed due to the following error: 80070005 Access is denied
https://jayeshsidhwani.wordpress.com/tag/hresult-0x80070005-e_accessdenied/
https://waheedrous.wordpress.com/2014/01/26/error-office-interop-assemblies
But I got to nowhere.
I also tried to run my app in the server but as localhost and it worked perfectly, zero problems.
I noticed that the CLSID in the error message it isn't the same as the Microsoft Word 97 - 2003 Document Component Service App ID.
The only tutorial that got me somewhere is this one http://toastergremlin.com/?p=543. The error was gone but the Word wasn't being opened and the web service just got stuck.
In the Microsoft Word 97 - 2003 Document Component Service I tried to add the following users: NETWORK_SERVICE, IIS_IUSRS, PC\Users and the apppool associated with my website.
I had similar issue when trying to create my own Interop DLL thru IIS web. And after lot of searches, this post solved my life

unable to access com component for OneNote via windows service

I have a console application which extracts text from images using Onenote com,when i run this application by myself it works fine but if i try to run it using windows service it gives error : "Retrieving the COM class factory for component with CLSID {D7FAC39E-7FF1-49AA-98CF-A1DDD316337E} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"
As far as i know, it is because of not interactive nature of services.
I even tried "Allow service to interact with desktop" option for the service but it didn't work as well.I will really appreaciate any suggestion

WCF Service Access Denied for Microsoft office introp word Application

I was working on file conversion of doc to docx in my using WCF service that are hosted on IIS. When I was trying to create an object for
var app = new Microsoft.Office.Interop.Word.Application();
I got this 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 (E_ACCESSDENIED)).
I also did DCOM Config that I found solution from other posts but still I have same problem.

Categories