Click here to Skip to main content
15,885,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have written a windows service in C#, my service is meant to open an excel macro enabled workbook (this is in Excel 2010) i have installed this service on our server which is running server 2008, it is 64 bit. My service seems to have a problem launching Excel when no one is logged on the server, does anyone have a solution to this.

i get the following error System.Runtime.InteropServices.COMException (0x8000401A): Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 8000401a.

Excel is installed on the server, the service works fine when i am logged on the server but once all users have logged off i get the above error. i would like the service to launch my excel work book regardless of an open sesson on the server or not.
Posted
Updated 19-May-19 14:14pm
v2
Comments
Rajesh Anuhya 31-Jan-12 0:54am    
Edited for readbulity.
--RA
Herman<T>.Instance 31-Jan-12 4:07am    
what user is running the service? Does that user have enough rights to start excel?
RowenaReddy 31-Jan-12 4:56am    
Well Digimanus thx you for your response, i think so, but just so i know i am doing it correctly, how would you check if the User has enough permissions?, i also tried what was mentioned in the discussion you referred me to and changing the identity in the Dcom Config properties for Microsoft excel application to this user worked, but to my dismay, our company will not allow this as it is not best practice, so i am now trying to find a different way around this. Any other ideas?
Herman<T>.Instance 31-Jan-12 9:25am    
set the excel file in MyDocuments folder of the user the service uses. It should have apprpriate rights then.

CSS
Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 8000401a.


It should be the permissions problem.
Please have a try using the following steps to Configure DCOM:
1. Go to the Start-Run menu to type in "dcomcnfg"  and hit enter to load "Component Services" MMC.
2. Select the "Microsoft Excel Application" item through "Component Services" MMC->Component Services->Computers->My Computer->DCOM Config->Microsoft Excel Application
3. Right click and select Properties->Select Identity Tab->Select This user and add the Administrator accout and password
4. Select Security Tab, Under "Launch and Activation Permissions", Choose "Customize", Click "Edit" button, Add the everyone account and add all the Permissions.
5. Do the same thing in "Access Permissions" and "Configuration Permissions"
 
Share this answer
 
Comments
Rajesh Tadha 2-Jul-18 4:22am    
i also had the same problem and was solved with the above solution. thanks @thichhochoi
Member 9320875 24-Oct-19 10:25am    
thanks really was struggling the whole week and you had the solution! :)
Member 12870741 18-Mar-20 8:18am    
This also works for me but my other problem is that if I open Excel files I get an error: Cannot use object linking and embedding. How do I fix this? This only happens when I change the Identity to "This user" I will really appreciate your help. I have been sitting with this problem forever. Thanks
Alen Markov 17-Feb-23 5:50am    
Wow - even this is an old thread, it just saved my day! (Was struggling for hours too...)
Error with Excel and asp.net when logged off the server


i give all permission in Excel application but not resolve the Error.

1. Go to the Start-Run menu to type in "dcomcnfg" and hit enter to load "Component Services" MMC.
2. Select the "Microsoft Excel Application" item through "Component Services" MMC->Component Services->Computers->My Computer->DCOM Config->Microsoft Excel Application
3. Right click and select Properties->Select Identity Tab->Select This user and add the Administrator accout and password
4. Select Security Tab, Under "Launch and Activation Permissions", Choose "Customize", Click "Edit" button, Add the everyone account and add all the Permissions.
5. Do the same thing in "Access Permissions" and "Configuration Permissions"


CSS
Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046}
failed due to the following error: 8000401a.





at SimplifiedReports.export(Int16 index, Feeder feed, Int16 submission) at
SimplifiedReports.btnExportExcel_Click(Object sender, EventArgs e) at
System.Web.UI.WebControls.Button.OnClick(EventArgs e) at
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) at
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String
eventArgument) at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) at
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean
includeStagesAfterAsyncPoint)
Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046}
failed due to the following error: 8000401a.
Project id 123
Client TANEJA VIDHYUT CONTROL PVT. LTD.
Project UNITECH INFOSPACE SEZ-TIKRI, GURGAON 140621-E


Please reply me...


Pankaj Tripathi
 
Share this answer
 
you can create another user , then login with that and create remote to 121.0.0.1 and main user (loopback to rpc!!!) then diconnect from new user and you will have interactive user
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900