L
Lars-Erik Aabech
Hi!
This issue have been discussed a lot, but I haven't found a solution that
applies to ASP.NET. I have a library which does some operations on Excel
documents, and it will be used in an ASP.NET application. If I use the
library in a Forms application, the Excel process is removed when the
cleanup operations are done, but with ASP.NET all possible ways to clean up
fails.
The following code has been tried:
Application app = new ApplicationClass();
Workbook wb = null;
// some code... no sheet reference done, only doing wb.load, x =
wb.Worksheets.Count, wb.close
// release workbook
ReleaseComObject(wb);
wb = null;
app.Quit();
ReleaseComObject(app);
app = null;
When the method is called from a windows app, Excel is now gone, but when
called from ASP.NET the Excel process remains.
So we gathered that the process had to be killed manually. Off to the Win32
api to find some functions. Et voila, we find GetWindowThreadProcessId. But
what do you know? When the method is called from a windows app, the process
ID is filled and we can kill the process, but when called from ASP.NET, the
process ID is 0, the thread ID is 0, and Excel is still lingering about..
I for one am ready to be committed to the local asylum...
Any help greatly appreciated......
Lars-Erik
This issue have been discussed a lot, but I haven't found a solution that
applies to ASP.NET. I have a library which does some operations on Excel
documents, and it will be used in an ASP.NET application. If I use the
library in a Forms application, the Excel process is removed when the
cleanup operations are done, but with ASP.NET all possible ways to clean up
fails.
The following code has been tried:
Application app = new ApplicationClass();
Workbook wb = null;
// some code... no sheet reference done, only doing wb.load, x =
wb.Worksheets.Count, wb.close
// release workbook
ReleaseComObject(wb);
wb = null;
app.Quit();
ReleaseComObject(app);
app = null;
When the method is called from a windows app, Excel is now gone, but when
called from ASP.NET the Excel process remains.
So we gathered that the process had to be killed manually. Off to the Win32
api to find some functions. Et voila, we find GetWindowThreadProcessId. But
what do you know? When the method is called from a windows app, the process
ID is filled and we can kill the process, but when called from ASP.NET, the
process ID is 0, the thread ID is 0, and Excel is still lingering about..
I for one am ready to be committed to the local asylum...
Any help greatly appreciated......
Lars-Erik