Click here to Skip to main content
15,886,857 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hello all

Few days ago I deployed an ASP.NET application on the free .NET hosting Somee.com for testing purposes before deploying on paid hosting, but part of my application uses Excel interop using Microsoft.Office.Interop.Excel . The problem is that the web server crashes with the following message:

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

The solution I found is to configure IIS to run 32 bit application but I don't have access to the IIS server I'm using!

I'm using Excel Interop because of its flexibility in creating the excel file, formatting and editing the cells, etc. but I could not find any source code or library that has same (or at least near) capabilities. Most of the code I found, especially here on codeproject.com, creates the file and downloads it directly, I want to store it to a folder first. Any help is really appreciated!

The website is nearly done and I need to test the excel part since it's working on the integrated ASP.NET development server.
Posted
Updated 21-Jul-14 2:16am
v2
Comments
[no name] 21-Jul-14 8:17am    
This is exactly the reason that Microsoft tells you not to do this and won't support it. You need to change to something that does not rely on Excel being installed on the computer.
Abdallah Al-Dalleh 21-Jul-14 8:24am    
Sorry man, didn't understand a letter of your comment :|
[no name] 21-Jul-14 9:14am    
If you do not understand a simple thing like "You cannot do that", then how do you expect to understand anything more technical?
Abdallah Al-Dalleh 21-Jul-14 9:20am    
Sorry :P Just installed NuGET Package Manager and it workd! :D
Now to deploy it and see if it works

You can't use Excel interop unless Excel is installed on the server computer: and even for a paid service this is unlikely. Installing Office products on any server system is unusual as users don't get a chance to go near them (thankfully) :laugh:

You would be a lot, lot better off finding a different way to do this - Excel is unlikely ever to be available to your website.
 
Share this answer
 
The issue is that in order to use Excel Interop Excel must be installed on the server. I highly doubt any free host or any shared hosting will allow that. It causes more problem than benefits. Wes is correct that Microsoft does not support interop.

There are several free and open source solutions that work well The following link list a couple

http://stackoverflow.com/questions/151005/create-excel-xls-and-xlsx-file-from-c-sharp[^]
 
Share this answer
 
Comments
Abdallah Al-Dalleh 21-Jul-14 8:45am    
How to add reference to those dll for use on the server ? remember this is a free hosting and not much features are available
AnvilRanger 21-Jul-14 9:01am    
Both are available as nuget packages. You add them to your solution and build just like any other component. The assemblies will be copied to the bin folder of your projects and deployed.
Abdallah Al-Dalleh 21-Jul-14 9:11am    
Any tutorials ? haven't dealt with "NuGet" Before.
Abdallah Al-Dalleh 21-Jul-14 10:02am    
This EPPlus SDK is super !! It has almost the same operation as Excel Interop. The report was generated successfully! now deploying to the web server with NuGET packages and testing. THANKS A LOT MAN !! =)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900