Error "8000401a" while C# Excel generation

1

I work on a MVC web application. This application has quartz.net job that start along with the application on deployment. quartz(third party dlls) was only being used for scheduling. This scheduled job is coded on C#. This job generates excel reports and emails it to the stake holders. Inorder to create and write data to excel i am depending on Microsoft Interop Assemblies. This job now runs fine on local(development box).But when its deployed to a remote application server, it throws an exception as follows:

Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 8000401a The server process could not be started because the configured identity is incorrect. Check the username and password. (Exception from HRESULT: 0x8000401A).

Observation: If i log onto the remote server (deployment server) at the time of excel generation, the excel gets emailed successfully. Problem occurs when i logoff from the Remote application server. I have searched for a solution, but nothing worked out. Anticipating for some direction. Thanks in advance.

asp.net-mvc
c#-4.0
excel-interop
job-scheduling
asked on Stack Overflow Feb 9, 2017 by Narendra Pasupuleti • edited Feb 10, 2017 by Narendra Pasupuleti

1 Answer

0

You can try this:

  • extract the scheduling and the code that generates the Excel files in a separate Windows service.
  • log on the new serice with Local System.

This way the service should work whether an user is logged on or not. Make sure you give permissions to the folder where the Excel files are generated.

answered on Stack Overflow Feb 13, 2017 by Mihail Stancescu

User contributions licensed under CC BY-SA 3.0