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

0

I have created windows service in .Net 4.5.Service is written to open outlook client, read emails from Inbox folder, downloads attachments.The code written is correct, since I have run & tested it in console application project. But when I install the web service using "installutil" and run it, the service throws following error on following line of code:

Outlook.Application myApp = new Outlook.Application();

Error:

Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80010001 Call was rejected by callee. (Exception from HRESULT: 0x80010001 (RPC_E_CALL_REJECTED))Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80010001 Call was rejected by callee. (Exception from HRESULT: 0x80010001 (RPC_E_CALL_REJECTED)).

FYI, the service is not running on my machine,I feel that service might require some permission, if so please let me know how to assign permissions to windows service.

.net
windows
c#-4.0
service
outlook-2010
asked on Stack Overflow Apr 4, 2016 by Dot Net Developer • edited Apr 22, 2016 by Mehdi

1 Answer

1

Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.

If you are building a solution that runs in a server-side context, you should try to use components that have been made safe for unattended execution. Or, you should try to find alternatives that allow at least part of the code to run client-side. If you use an Office application from a server-side solution, the application will lack many of the necessary capabilities to run successfully. Additionally, you will be taking risks with the stability of your overall solution. Read more about that in the Considerations for server-side Automation of Office article.

Use a low-level API instead - Extended MAPI. Or any other third-party wrappers around that API (for example, Redemption).

answered on Stack Overflow Apr 4, 2016 by Eugene Astafiev

User contributions licensed under CC BY-SA 3.0