Error Parsing Excel on IIS7 on Server 2008

Posted on 2009-02-19
Last Modified: 2012-05-06
We have an application (C#) that :
1. uploads excel files to the server
2. extracts data from excel file
3. writes data to SQL Server 2005

Everything works locally. The problem arises when app runs on server. Here is the error

System.Runtime.InteropServices.COMException (0x800A03EC): Microsoft Office Excel cannot access the file 'D:\RNGWeb\5-Virtual\templates\SSS\temp\37\Arcandor AG.xlsx'. There are several possible reasons:

" The file name or path does not exist.
" The file is being used by another program.
" The workbook you are trying to save has the same name as a currently open workbook.
   at Microsoft.Office.Interop.Excel.Workbooks.Open(String Filename, Object UpdateLinks, Object ReadOnly, Object Format, Object Password, Object WriteResPassword, Object IgnoreReadOnlyRecommended, Object Origin, Object Delimiter, Object Editable, Object Notify, Object Converter, Object AddToMru, Object Local, Object CorruptLoad)
   at RNG.ADU.SSSProcesser.ExtractAndExport() in C:\Trunk\RNG.ADU\Processer\SSSProcesser.cs:line 52 (D:\RNGWeb\5-Virtual\templates\SSS\temp\37\Arcandor AG.xlsx)

It's happening while trying to open a workbook

Here is the code:

protected override void ExtractAndExport()

            Application excelApp = null;
            Workbook workbook = null;

                // instantiate excel application
                excelApp = new Application();
            catch (Exception ex)
                m_logger.Error(String.Format("{0} ({1})", ex.ToString(), TemplatePath));

                // find excel file
                workbook = excelApp.Workbooks.Open(
                    TemplatePath,   // Filename
                    0,              // UpdateLinks
                    true,           // ReadOnly
                    5,              // Format
                    "",             // Password
                    "",             // WriteResPassword
                    false,          // IgnoreReadOnlyRecommended
                    XlPlatform.xlWindows, // Origin
                    "",             // Delimiter
                    false,          // Editable
                    false,          // Notify
                    0,              // Converter
                    true,           // AdToMru
                    false,          // Local
                    false           // CorruptLoad
            catch (Exception ex)
                m_logger.Error(String.Format("{0} ({1})", ex.ToString(), TemplatePath));


I've given NETWORK Service, IUSR, and ASPNET full access to files location. I also added these accounts to DCOM for Microsoft Excel Application.


Server Environment

Windows Server 2008
.NET Framework 2.0 (version 2.0.50727.42)
MIcrosoft Office 2007
SQL Server 2005

Local Environment

ASP.NET (VS2005)
MIcrosoft Office 2007
SQL Server 2005


Please let me know if you need more info to understand the issue.

Thanks in advance
Question by:RNGAdmin
    LVL 22

    Accepted Solution

    Chances are the Network service account that is typically used to run applications through IIS does not have the permissions it needs to do this.

    Try changing the account that the application pool is using to local service account and see if this resolves the problem.

    Author Comment

    Where can I do that?

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    A publishing tool, a Version Control System, or a Collaboration Platform! These can be some of the defining words for the two very famous web-hosting Git repositories: Bitbucket and Github. Git is widely used amongst the programmers and developers f…
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    This video teaches users how to migrate an existing Wordpress website to a new domain. provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now