Outlook in ASP.NET C# - 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.

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).

Retrieving the COM class factory for component with CLSID failed due to the following error: 80040154 Class not registered

I have a web application which is used to send email. In this application, I am reading data from an Excel file and send email.
This is working fine in the local system, but not working after uploading on the server.
I have received the following errors
Retrieving the COM class factory for component with CLSID
{00024500-0000-0000-C000-000000000046} failed due to the following
error:
80040154 Class not registered (Exception from HRESULT: 0x80040154
(REGDB_E_CLASSNOTREG)).
How can I fix it?
Solution: to this badimageformatexception is setting the 'Enable32bitApplications' to 'True' in IIS Apppool properties for the right apppool.

Error E_ACCESSDENIED in C# Microsoft.Office.Interop.Excel()

I have created a windows service that repetitively updates the same excel file. While running the Windows Service, I am receiving the following Error:
Error Message Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
This error is thrown at the following line of code:
ExcelApp = new Microsoft.Office.Interop.Excel.Application();
Is there a work-around for this ?
I followed the steps mentioned in the following SO link but that didn't helped me overcome these error. I tried solution from few other questions as well and none of them worked for me.

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.

Office Interop Issue on Windows Server

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

Categories