来自网页的ASP.NET Excel宏

时间:2012-05-24 03:33:42

标签: asp.net excel

我正在尝试从ASP.NET应用程序访问Excel宏。当我尝试在Visual Studio中本地运行它时它工作得很好,但是一旦我在IIS网络服务器上部署它,我就会收到以下错误:

ASP.NET Error

我正在使用Interop.Microsoft.Office.Interop.Excel.dll类来访问Excel文件并像这样运行宏:

        // Create an instance of Microsoft Excel, make it visible, and open AquaticChemistry
    Excel.ApplicationClass oExcel = new Excel.ApplicationClass();
    oExcel.Visible = true;
    Excel.Workbooks oBooks = oExcel.Workbooks;
    Excel._Workbook oBook = null;

    String excelFile = Server.MapPath("AquaticChemistry_DrinkingWater.xlsm");

    oBook = oBooks.Open(excelFile, oMissing, oMissing,
        oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, 
        oMissing, oMissing, oMissing, oMissing, oMissing, oMissing);

    // Run the macro Phreeqc
    RunMacro(oExcel, new Object[] { "RunPhreeqc", Server.MapPath("phreeqc_wt.dat") });

    // Save and quit Excel and clean up
    oBook.Save();
    oBook.Close(false, oMissing, oMissing);

我试图让网络服务帐户访问Excel文件,但它没有帮助。有什么建议吗?

0 个答案:

没有答案