Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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,

Francesco

share|improve this question

2 Answers 2

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)
http://epplus.codeplex.com/

Or Excellibrary (for .XLS) http://code.google.com/p/excellibrary/
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).
http://npoi.codeplex.com

share|improve this answer

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")

source: http://forums.iis.net/t/1148371.aspx

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.