S
Seshadri
We are using Microsoft.Interop.Excel in our dotnet web application for
downloading the data in the excel.
Once the download is completed the excel object is not getting killed or
released from the memory automatically (The EXCEL.EXE*32 process still
appears in the Task Manager).
When ever the "Download" button is clicked a new EXCEL.EXE process is
getting created but not cleared disposed from the memory.
This EXCEL.EXE process resides in the task manager unless it is killed
manually.
Below is the code block which we have written to dispose the excel object
from the memory.
/* Code Block starts */
Excelworkbook.Close(false, WorkBookPath, false);
Excelapp.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject(objExcelcellRange);
System.Runtime.InteropServices.Marshal.ReleaseComObject(objExcelworksheet);
System.Runtime.InteropServices.Marshal.ReleaseComObject(objExcelsheets);
System.Runtime.InteropServices.Marshal.ReleaseComObject(objExcelworkbook);
System.Runtime.InteropServices.Marshal.ReleaseComObject(objexcelapp);
objExcelworksheet = null;
objExcelsheets = null;
objExcelworkbook = null;
objExcelapp = null;
GC.Collect();
/* Code Block ends */
Steps we tried to resolve this issue
1. Added "Network Service" User in the DCOMCONFIG --> Microsoft Excel
Application --> Security --> Configuration Settings and gave full control.
The above step didn't work.
Please suggest how we can dispose the EXCEL object from the memory using
Interop services through code.
Thank you.
downloading the data in the excel.
Once the download is completed the excel object is not getting killed or
released from the memory automatically (The EXCEL.EXE*32 process still
appears in the Task Manager).
When ever the "Download" button is clicked a new EXCEL.EXE process is
getting created but not cleared disposed from the memory.
This EXCEL.EXE process resides in the task manager unless it is killed
manually.
Below is the code block which we have written to dispose the excel object
from the memory.
/* Code Block starts */
Excelworkbook.Close(false, WorkBookPath, false);
Excelapp.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject(objExcelcellRange);
System.Runtime.InteropServices.Marshal.ReleaseComObject(objExcelworksheet);
System.Runtime.InteropServices.Marshal.ReleaseComObject(objExcelsheets);
System.Runtime.InteropServices.Marshal.ReleaseComObject(objExcelworkbook);
System.Runtime.InteropServices.Marshal.ReleaseComObject(objexcelapp);
objExcelworksheet = null;
objExcelsheets = null;
objExcelworkbook = null;
objExcelapp = null;
GC.Collect();
/* Code Block ends */
Steps we tried to resolve this issue
1. Added "Network Service" User in the DCOMCONFIG --> Microsoft Excel
Application --> Security --> Configuration Settings and gave full control.
The above step didn't work.
Please suggest how we can dispose the EXCEL object from the memory using
Interop services through code.
Thank you.