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 1042591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:31:57+00:00 2026-05-16T15:31:57+00:00

Recently deployed my web app on Windows Server2008, IIS7 (with Office installed). After chasing

  • 0

Recently deployed my web app on Windows Server2008, IIS7 (with Office installed).

After chasing (& catching) various other errors, I’m facing one I’m not sure even where to begin.

On Cassini (visual studio dev server) everything worked flawlessly (reading excel through excel interop).

On w2008 IIS it throws vague error:

Value cannot be null.
Parameter name: o

[ArgumentNullException: Value cannot be null.
Parameter name: o]
System.Runtime.InteropServices.Marshal.FinalReleaseComObject(Object o) +9430474
longnamespace.ExcelReader.Dispose() in c:\longpath\ExcelReader.cs:23
longnamespace.ApplicationFormReader.Read(String path) in c:\longpath\ApplicationFormReader.cs:32

Currently, I’m going to add null check and see if things get better but I do suspect that it just blows up and disposes on finally block before it even starts reading anything.

Tried to set application pool to run under localsystem, but that didn’t change anything.

Any ideas?


This is how dispose method looks like

    //http://stackoverflow.com/questions/158706/how-to-properly-clean-up-excel-interop-objects-in-c/159419#159419
    public void Dispose(){
      GC.Collect();
      GC.WaitForPendingFinalizers();
      GC.Collect();
      GC.WaitForPendingFinalizers();
      Marshal.FinalReleaseComObject(_ws); //Worksheet, line 23
      _wb.Close();
      Marshal.FinalReleaseComObject(_wb); //Workbook
      _ap.Quit();
      Marshal.FinalReleaseComObject(_ap); //Application
    }

I believe this event is related

The machine-default permission settings do not grant Local Activation permission for the COM Server application with CLSID
{00024500-0000-0000-C000-000000000046}
to the user NT AUTHORITY\NETWORK SERVICE SID (S-1-5-20) from address LocalHost (Using LRPC). This security permission can be modified using the Component Services administrative tool.

If so – could anyone translate?

Adding right for Microsoft Excel Application to Network service in component services somehow didn’t work. kind a.

Removing authentication level didn’t help too.


Changed to

  if (_ws != null)
    Marshal.FinalReleaseComObject(_ws);
  if (_wb != null)
  {
    _wb.Close();
    Marshal.FinalReleaseComObject(_wb);
  }
  if (_ap != null)
  {
    _ap.Quit();
    Marshal.FinalReleaseComObject(_ap);
  }

let’s see how it goes…

  • 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-05-16T15:31:58+00:00Added an answer on May 16, 2026 at 3:31 pm

    The exception looks fairly straightforward: at line 23 in your code you are calling Marshal.FinalReleaseComObject, passing a null reference.

    So _ws, _wb or _ap is a null reference. You’ll be able to see which if you look for line 23.

    To solve this, test for null before calling FinalReleaseComObject.

    The GUID {00024500-0000-0000-C000-000000000046} referenced in your event is Excel – as you’ll be able to see with RegEdit.

    So what I suspect is happening is that code you haven’t posted that tries to instantiate an Excel Application object (_ap?) throws an exception due to insufficient permission. Then because your Dispose method isn’t checking for _ap being null, it’s throwing again there.

    I suspect you’re on the right track when you’re looking to give Local Activation permission to the Network Service account. Not sure why this isn’t working, maybe you need to reboot or restart IIS?

    UPDATE Also Excel Interop is not recommended in server applications. It’s better to manipulate Excel documents some other way, e.g. using a 3rd party component such as Aspose.

    One thing I seem to remember is that Excel needs to run under an account that has a local profile, which may not be the case for the Network Service account. So running it under a different account as you mentioned in the comment might be the best solution if you need to use Excel Interop.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

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.