Error: Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046}

0

I have created windows service in .Net 4.5.Service is written to open outlook client. The code written is correct, since I have run in local host. But when I run from IIS Server, the server throws following error on following line of code:

Error retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 0x80040154 Class not registered

I tried the following solutions:

IIS Server > Advanced Settings > Enable 32 Bit APP = true & Identity=Windows

Many Thanks

c#
iis
asp.net-web-api
asked on Stack Overflow Dec 20, 2018 by Mehmet Can • edited Dec 20, 2018 by Gonzo345

1 Answer

0

The IIS runs in a low privilege mode, I believe it is NETWORK SERVICE. This account is restricted heavily from using client-related COM objects, and Outlook client is registered under the respective user account. Technically, you change the (COM configuration)[https://docs.microsoft.com/en-us/windows/desktop/com/hkey-local-machine-software-microsoft-ole], but you should not do it.

Office objects, including Outlook, require a logged user session. With Outlook in particular, it requires a logged user who also has a registered Outlook profile, and an Exchange license (if applicable).

In your case, when you run it from the local host, you have such a session - yours. When you run it on IIS, this session is not available.

What you want to do if officially not supported and is greatly discouraged.

answered on Stack Overflow Dec 20, 2018 by Nick

User contributions licensed under CC BY-SA 3.0