Click here to Skip to main content
11,439,025 members (79,413 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Excel
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 30-Jan-12 19:45pm
Edited 30-Jan-12 19:53pm
v2
Comments
Rajesh Anuhya at 31-Jan-12 0:54am
   
Edited for readbulity.
--RA
digimanus at 31-Jan-12 4:07am
   
what user is running the service? Does that user have enough rights to start excel?
RowenaReddy at 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?
digimanus at 31-Jan-12 9:25am
   
set the excel file in MyDocuments folder of the user the service uses. It should have apprpriate rights then.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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"
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

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"


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
  Permalink  

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



Advertise | Privacy | Mobile
Web01 | 2.8.150506.1 | Last Updated 9 Jul 2014
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100