Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8546587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:03:56+00:00 2026-06-11T13:03:56+00:00

I am facing a situation here and would like some feedback or advice. I

  • 0

I am facing a situation here and would like some feedback or advice.
I have been given an application that run as a service, with a specific service account (not admin on the server), and try to open an Excel workbook.

The problem is not with the initial application, as I can reproduce it with the generic C# code below (embedded in a service structure):

try{
    this._exApp = new Microsoft.Office.Interop.Excel.ApplicationClass();
    this._exApp.Visible = false;

    Log.Logger.Info("Opening workbook...");
    Workbook workbook = this._exApp.Workbooks.Open(
                thisFileName,
                Type.Missing,
                Type.Missing,
                Type.Missing,
                Type.Missing,
                Type.Missing,
                Type.Missing,
                Type.Missing,
                Type.Missing,
                Type.Missing,
                Type.Missing,
                Type.Missing,
                Type.Missing,
                Type.Missing
                );
    Log.Logger.Info("Workbook opened!");

    //Do something with the result
    Log.Logger.Info("Closing workbook...");
    workbook.Close(false, thisFileName, null);
    Marshal.ReleaseComObject(workbook);

    this._exApp.Quit();
}
catch(Exception ex){
    Log.Logger.Error(ex.Message);
}

(nothing special about *this._exApp* and thisFileName, which are just respectively casted to a Microsoft.Office.Interop.Excel.Application, and as a string with the path of the file to open. Log.Logger is a a logger class using log4net to allow me seeing when the problem occurs)

The service is running as a service account, which is a user on the server, not an admin. It has access to the target file and to files on the server (as Read access). The server is a Windows Server 2003 Standard Edition SP2 (could not try yet on a 2008 R2 server).

The problem I am facing is that it just hangs when trying to open the workbook, so in terms of tracing the last line I have is “Opening workbook…”, never reaching the “Workbook opened” line. No exception is raised.

So the code is very simple, it is just trying to open an excel workbook. I have done already some investigations, and here are my findings:

  • I know that Microsoft does not support a server side Excel automation, but I have been given the service as it, and do not have a choice about the technology used.
  • I have configured all the Component Services/DCOM/Microsoft Excel Application security settings so that the service account has all the permissions possible.
  • The service does the job correctly if the service account is local admin on the machine. This is not really on option for production.
  • The service does the job correctly if the file it tries to open is a local file. Unfortunately, the file we tries to access is on a remote file server, and it does not work in that situation.
  • The code above run from a command line with the same user on a remote file works fine, but not any more when run as a service.
  • I have read about the C:\Windows\System32\config\systemprofile\Desktop bug, but the folder exists.
  • Excel open correctly when lauched with the service account.

So basically, the situation is the Workbooks.Open method hangs when run as a service, under a service account that is not admin, and when accessing a remote file.

I would appreciate any input or idea on this topic.

Thanks.

Jonathan

EDIT: As per Matt’s workaround below, we have implemented a local copy of the remote file, so I am accepting it as an answer, but I remain interested in any suggestion on how to make it work directly on the remote file.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T13:03:58+00:00Added an answer on June 11, 2026 at 1:03 pm

    I would have put this as a comment, but I don’t have enough rep yet, so this is more just a possible workaround rather than a full blown answer…

    The service does the job correctly if the file it tries to open is a local file. Unfortunately, the file we tries to access is on a remote file server, and it does not work in that situation.

    Can you first copy the file from the remote server to a local temp location?

            this._exApp = new Microsoft.Office.Interop.Excel.ApplicationClass();
            this._exApp.Visible = false;
    
            string localFile = "local.xls";
            System.IO.File.Copy(thisFileName, localFile);
    
            Log.Logger.Info("Opening workbook...");
            Workbook workbook = this._exApp.Workbooks.Open(localFile, ...);
            Log.Logger.Info("Workbook opened!");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm facing a situation where I have dependent objects and I would like to
Here is the situation that I'm facing: I have two tables A and B.
Hello to all I am here facing some situation of detecting url in asp.net
I am facing a situation at which my development team would like to re-organize
I am facing a situation that I have problem understanding... I am writing a
I have an application that uses UIDatePicker & I am facing problem as described
Here's the situation i'm currently facing. I have an embedded youtube video as <object>
I am just wondering if anyone have some info or feedback about the situation
I am facing some odd situation that when I select/deselect the features in the
I am facing a situation and need help. I have two tables: user: user_id

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.