在调用“ app.quit”

时间:2019-06-14 03:26:08

标签: c# asp.net

在退出应用程序后,Excel.exe仍在任务管理器中运行。 我尝试了以下代码:

            wb.Save(); //WB is workbook
            wb.Close(true);
            wbs.Close();
            app.Quit(); //Excel application
            Marshal.ReleaseComObject(ws);
            Marshal.FinalReleaseComObject(ws);
            Marshal.ReleaseComObject(wb);
            Marshal.FinalReleaseComObject(wb);
            Marshal.ReleaseComObject(wbs);
            Marshal.FinalReleaseComObject(wbs);
            Marshal.ReleaseComObject(app);
            Marshal.FinalReleaseComObject(app);

            GC.Collect();
            GC.WaitForPendingFinalizers();
            GC.Collect();
            GC.WaitForPendingFinalizers();

0 个答案:

没有答案
相关问题