I can successfuly create an Excel Spreadsheet on my local system, but when I deploy the application to the testserver, I get an internal server error.(500). The application is written in MVC.
Things I have tried so far:
I've installed MS Office on the testserver
In internet explorer deselect the checkbox Show Friendly HTTP Error Messages'
Give full control for 'Network Service' and 'Everyone' in DCOM Config -> Microsoft Excel Application (for 'Launch and activation permission','Access permission','Configuration permission')
But I am getting the same error(Internal server error - 500)
I have been trying this for the whole result but there is nothing that seems helpful.
Are you relying on Microsoft Excel API on the server? If so that could explain the error since excel is not designed to work well in a server environment. there are 3rd party options available and there is a free option called NPOI if I remember right that
allows you to do excel manipulation and exports on the server. .
Jeev
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you get the answer to your question, please mark it as the answer.
Thanks for your reply. Ya I am using Microsoft.Office.Interop.Excel to export Excel file.I would be highly pleased if you could be more specific about the solution.
there are 3rd party component vendors like ASPOSE and FARPOINT that have components that allow you to create and manipulate excel on the server. These components have no dependency on Excel and hence work fine in such scenarios
Thanks for your prompt reply. Yesterday just before I got your mail I found on the net that ExcelLibrary is a good choice for creating and reading simple excel files in the server. And to test that, I added the reference to my project and it worked like
magic, by writing a single line of code, I can now save excel files in the server.
But I dont know how to open that file in the browser so users can save it in their local computers. It would be of great help if you could help me in how can I view the excel file saved in the test server in the client browser. Can I do it in ExcelLibrary
or for that I need to implement NPOI.
Thanks for your reply. I am trying to view the file in the following way.
1. Created a class from ActionResult and given the filename and the path to open the file.
While running the code I am geting the error : "Access to the path C:/Temp is denied".
I have tried each and every possibility of permission grants (given full permission to Everyone,NETWORKSERVICES,User,AuthenticatedUser) but nothing helps.
The weired part is it is creating the report but doesnt allow to read from it.
666
Member
90 Points
81 Posts
Exporting to EXCEL Spreadsheet not working on Deployment Server
Jun 13, 2011 01:56 PM|LINK
Hi,
I can successfuly create an Excel Spreadsheet on my local system, but when I deploy the application to the testserver, I get an internal server error.(500). The application is written in MVC.
Things I have tried so far:
But I am getting the same error(Internal server error - 500)
I have been trying this for the whole result but there is nothing that seems helpful.
Any help would be appreciated.
Many thanks.
Sanhita
Jeev
All-Star
24182 Points
3719 Posts
Re: Exporting to EXCEL Spreadsheet not working on Deployment Server
Jun 13, 2011 02:10 PM|LINK
Are you relying on Microsoft Excel API on the server? If so that could explain the error since excel is not designed to work well in a server environment. there are 3rd party options available and there is a free option called NPOI if I remember right that allows you to do excel manipulation and exports on the server. .
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you get the answer to your question, please mark it as the answer.
666
Member
90 Points
81 Posts
Re: Exporting to EXCEL Spreadsheet not working on Deployment Server
Jun 13, 2011 02:21 PM|LINK
Hi,
Thanks for your reply. Ya I am using Microsoft.Office.Interop.Excel to export Excel file.I would be highly pleased if you could be more specific about the solution.
Thanks again.
Sanhita
Jeev
All-Star
24182 Points
3719 Posts
Re: Exporting to EXCEL Spreadsheet not working on Deployment Server
Jun 13, 2011 02:44 PM|LINK
there are 3rd party component vendors like ASPOSE and FARPOINT that have components that allow you to create and manipulate excel on the server. These components have no dependency on Excel and hence work fine in such scenarios
NPOI is a free version that is available here http://npoi.codeplex.com/
this is a tutorial for NPOI
http://www.leniel.net/2009/07/creating-excel-spreadsheets-xls-xlsx-c.html
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you get the answer to your question, please mark it as the answer.
ignatandrei
All-Star
134960 Points
21632 Posts
Moderator
MVP
Re: Exporting to EXCEL Spreadsheet not working on Deployment Server
Jun 13, 2011 03:06 PM|LINK
runt the app pool under the user you have installed ms office.
666
Member
90 Points
81 Posts
Re: Exporting to EXCEL Spreadsheet not working on Deployment Server
Jun 14, 2011 10:39 AM|LINK
Hi,
Thanks for your prompt reply. Yesterday just before I got your mail I found on the net that ExcelLibrary is a good choice for creating and reading simple excel files in the server. And to test that, I added the reference to my project and it worked like magic, by writing a single line of code, I can now save excel files in the server.
But I dont know how to open that file in the browser so users can save it in their local computers. It would be of great help if you could help me in how can I view the excel file saved in the test server in the client browser. Can I do it in ExcelLibrary or for that I need to implement NPOI.
many Thanks again,
Sanhita
ignatandrei
All-Star
134960 Points
21632 Posts
Moderator
MVP
Re: Exporting to EXCEL Spreadsheet not working on Deployment Server
Jun 14, 2011 10:47 AM|LINK
<a href="path to saved excel file.xls"> excel</a>
or from an Action return FileContent(...)
666
Member
90 Points
81 Posts
Re: Exporting to EXCEL Spreadsheet not working on Deployment Server
Jun 14, 2011 01:00 PM|LINK
Hi,
Thanks for your reply. I am trying to view the file in the following way.
1. Created a class from ActionResult and given the filename and the path to open the file.
While running the code I am geting the error : "Access to the path C:/Temp is denied".
I have tried each and every possibility of permission grants (given full permission to Everyone,NETWORKSERVICES,User,AuthenticatedUser) but nothing helps.
The weired part is it is creating the report but doesnt allow to read from it.
Any help would be highly appreciated.
Many Thanks,
Sanhita
666
Member
90 Points
81 Posts
Re: Exporting to EXCEL Spreadsheet not working on Deployment Server
Jun 14, 2011 01:24 PM|LINK
Hello,
Could you please send me the code for return FileContent to open the file in MVC. I am new to MVC and not getting the exact code from the net.
Thanks again
Sanhita
ignatandrei
All-Star
134960 Points
21632 Posts
Moderator
MVP
Re: Exporting to EXCEL Spreadsheet not working on Deployment Server
Jun 14, 2011 01:27 PM|LINK
Please show code ( did you use Server.MapPath?)