I am using Microsoft Office Excel Interop to create an excel file in ASP.NET C#. Everything is successful when I am running application in Visual Studio 2010. I have published my web application in my own IIS server, it is ok. But when I publish application in Windows Server 2008, the problem was detected. I looked for much in internet and i have done following, but the problem still was not solved:
I have set Application Pool Identity to LocalSystem. In Run -> mmc -32 -> Component Services -> My Computer -> DCOM Config -> Microsoft Excel Application -> right-click -> Properties window: in Identity tab, I have checked all radio buttons in this window.
I have set Application Pool Identity to NetworkService, and I have checked all previous radio buttons again.
In Run->mmc -32 -> Component Services -> My Computer -> DCOM Config -> Microsoft Excel Application -> right-click -> Properties window: in Security tab: I gave Local Launch and Local Activation for INTERACTIVE, NETWORK SERVICE, IIS_IUSRS users.
Here is my code which I used Interop Excel:
Excel.Application xlApp = new Excel.Application(); object misValue = System.Reflection.Missing.Value; Excel.Workbook xlWorkBook = xlApp.Workbooks.Add(misValue); Excel.Worksheet xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1); Workbook.SaveAs(Server.MapPath("DownloadFolder\\" + fileName + "_siyahi.xls"));