Click here to Skip to main content
Sign Up to vote bad
good
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 - 18:45
Edited 30 Jan '12 - 18:53

Comments
Rajesh Anuhya - 31 Jan '12 - 0:54
Edited for readbulity. --RA
digimanus - 31 Jan '12 - 4:07
what user is running the service? Does that user have enough rights to start excel?
RowenaReddy - 31 Jan '12 - 4:56
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 - 31 Jan '12 - 9:25
set the excel file in MyDocuments folder of the user the service uses. It should have apprpriate rights then.

2 solutions

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  

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 OriginalGriff 223
1 Ron Beyer 220
2 Aarti Meswania 200
3 Mahesh Bailwal 175
4 Rohan Leuva 170
0 Sergey Alexandrovich Kryukov 8,553
1 OriginalGriff 6,899
2 CPallini 3,648
3 Rohan Leuva 2,963
4 Maciej Los 2,308


Advertise | Privacy | Mobile
Web02 | 2.6.130516.1 | Last Updated 15 Dec 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid