You should read the following Microsoft knowledgebase article:
Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.
There are various ways to create Excel spreadsheets on the server without using Office interop. For example:
If you want the user to save the file on their computer, then you need to write it to the
Response
with the appropriate headers:
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
Response.AppendHeader("Content-Disposition", "attachment; filename=sheet.xlsx");
excelFile.SaveAs(Response.OutputStream);
If you want the user to save the file to a specified location on the server, then you're going to have to write a custom file-system browser to let the user select a location from your server's file-system. There's no built-in way to do that.
If you attempt to display a "Save As" dialog from server-side code, it will display on the server, where nobody will ever see it. It might
appear to work when you run your code in Visual Studio, but that's only because the server and client are the same computer in that specific case.