Reputation: 624
Hie guys I am in a bit of a Problem here regarding Export to Excel in asp.net where I am Exporting the Webgrid data to the Excel Sheet and it is working fine on localHost but not on the main server even when it is deployed on the Main server.
I am using Microsoft.Office.Interop.Excel.Application to genrate excel sheet.
When I click on the button for genrating Excel on the main server I get the following error-
Failed to Export-Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80040154.**Class Not registered
I googled for the solution bbut couldnt found one which can solver my problem I read it somewhere that I need to install Excel on my Main server too to get this functionality working. Is this is the solution or is their any Plugin which can help In order to solve this problem and export to excel work on the MainServer.. Please help
Upvotes: 0
Views: 1965
Reputation: 186
Short answer is – yes it’s necessary.
Long answer is that this is not recommended practice. Your web server is run by network service or some other limited privileges account that doesn’t even have permissions to run excel.
Extending those privileges to running excel may result in reduced security and potential damage to your server is something bad gets into your excel document (such as malicious macro or something like that).
Link Kyle provided is an excellent resource to find out more about this. If possible try to move to OpenXML or some other library.
Upvotes: 1
Reputation: 10236
I recommend you read server-side Automation of Office.
It is not good idea to acess excel data from main server. I would suggest you use Open XML instead.
You can also take a look at third parties tool's such as EPPlus
Upvotes: 1