Create App_Data and register Excel application on ASP.NET deployment? (IIS7.5)


I am deploying an ASP.NET MVC3 application in IIS7. I already deployed other applications but they never made use of the App_Data folder or any additional component such as the Interop library.

I used the one click deployement and I sue the default application pool. When I launch the application I immediately get an error stating:

[web access] Sorry, an error occurred while processing your request.

[browse from IIS7] Could not find a part of the path 'D:\Data\Apps\OppUpdate\App_Data\Test.xlsx'.

Then I manually added the App_Data folder inside the deployment directory and the application starts regularly. Then when it comes to the taks that uses the Interop library, I get the following error:

[web access] Sorry, an error occurred while processing your request.

[browse from IIS7] Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

Is there any way to automatically add the App_Data folder when using 1 click deploy? How can I register the Interop services?

Thanks you,


asked on Server Fault May 23, 2011 by CiccioMiami

2 Answers


Apparently the problem is linked with Server 2008. The Excel application to be executed on server side triggers the security popup which is now present in MS OS, such as Win 7 and Vista. This is the dialog it appears to the users everytime they run an application and warns them about the damages a not trusted application might bring to their PC. Obviously when the application, in this case Excel, is run by another application, in this case a web application,the dialog does not popup and the server does not get the authorization to run Excel.

The solution for this appalling BUG in Microsoft IIS & Excel is terrific:

Create directory "C:\Windows\SysWOW64\config\systemprofile\Desktop" Set Full control permissions for directory Desktop (for example in Win7 & IIS 7 & DefaultAppPool set permissions for user "IIS AppPool\DefaultAppPool")


answered on Server Fault May 24, 2011 by CiccioMiami

You shouldn't be using COM Office interop in a multithreaded environment like a web-application.

Try using a library that can read and write excel files. (for .xlsx)

Or Excellibrary (for .XLS)
Be aware the ExcelLibrary (not epplus) has a bug that makes sheets with less than 50 cells not working (4096 byte buffer bug).

NPOI writes XLS files bug-free, but since it's a java-port, it's less comfortable to read .xls files with it (ExcelLibrary reading is bug-free).

answered on Server Fault Dec 24, 2011 by Quandary

User contributions licensed under CC BY-SA 3.0