L
Leeor Chernov
Hi ,
I Used the object Excell Application(COM INTEROP) and it is staying as an
open process, And the owner(User Name) is ASPNET
Altough I try to release it with :
System.Runtime.InteropServices.Marshal.ReleaseComObject, And GC.Collect.
Every time I am opening a new Excel.Application() , I get more Processes in
memory.
Note: I am calling the CreateExcellObj each time I am pressing a button from
my web page
The release Methods sometimes release few Excell processes but the last one
always stays.
The Init method:
public void CreateExcellObj(string FilePath)
{
ExcelObj = new Excel.Application();
ExcelObj.Visible = true;
WorkBookObj = (Excel._Workbook) ExcelObj.Workbooks.Open(FilePath,
System.Reflection.Missing.Value,
true,
System.Reflection.Missing.Value,
System.Reflection.Missing.Value,
System.Reflection.Missing.Value,
System.Reflection.Missing.Value,
System.Reflection.Missing.Value,
System.Reflection.Missing.Value,
System.Reflection.Missing.Value,
System.Reflection.Missing.Value,
System.Reflection.Missing.Value,
System.Reflection.Missing.Value,
System.Reflection.Missing.Value,
System.Reflection.Missing.Value);
}
The Release methods:
private void Release()
{
WorkBookObj.Close(false,System.Reflection.Missing.Value,System.Reflection.Mi
ssing.Value);
ReleaseComObject(oSheet);
ReleaseComObject(WorkBookObj);
ExcelObj.Workbooks.Close();
ReleaseComObject(ExcelObj.Workbooks);
ExcelObj.Quit();
ReleaseComObject(ExcelObj);
//GC.WaitForPendingFinalizers();
GC.Collect();
DALObj.UpdateFromDTAndAdapter( curTable, null);
return requestID;
}
private void ReleaseComObject(object ComObj)
{
int result;
result =
System.Runtime.InteropServices.Marshal.ReleaseComObject(WorkBookObj);
// do
// {
// result =
System.Runtime.InteropServices.Marshal.ReleaseComObject(WorkBookObj);
// }
// while( result == 0);
ComObj = null;
}
How can I solve this problem
Thank you
Leeor Chernov
R&D Department
SPLSoftware LTD.
ISRAEL
I Used the object Excell Application(COM INTEROP) and it is staying as an
open process, And the owner(User Name) is ASPNET
Altough I try to release it with :
System.Runtime.InteropServices.Marshal.ReleaseComObject, And GC.Collect.
Every time I am opening a new Excel.Application() , I get more Processes in
memory.
Note: I am calling the CreateExcellObj each time I am pressing a button from
my web page
The release Methods sometimes release few Excell processes but the last one
always stays.
The Init method:
public void CreateExcellObj(string FilePath)
{
ExcelObj = new Excel.Application();
ExcelObj.Visible = true;
WorkBookObj = (Excel._Workbook) ExcelObj.Workbooks.Open(FilePath,
System.Reflection.Missing.Value,
true,
System.Reflection.Missing.Value,
System.Reflection.Missing.Value,
System.Reflection.Missing.Value,
System.Reflection.Missing.Value,
System.Reflection.Missing.Value,
System.Reflection.Missing.Value,
System.Reflection.Missing.Value,
System.Reflection.Missing.Value,
System.Reflection.Missing.Value,
System.Reflection.Missing.Value,
System.Reflection.Missing.Value,
System.Reflection.Missing.Value);
}
The Release methods:
private void Release()
{
WorkBookObj.Close(false,System.Reflection.Missing.Value,System.Reflection.Mi
ssing.Value);
ReleaseComObject(oSheet);
ReleaseComObject(WorkBookObj);
ExcelObj.Workbooks.Close();
ReleaseComObject(ExcelObj.Workbooks);
ExcelObj.Quit();
ReleaseComObject(ExcelObj);
//GC.WaitForPendingFinalizers();
GC.Collect();
DALObj.UpdateFromDTAndAdapter( curTable, null);
return requestID;
}
private void ReleaseComObject(object ComObj)
{
int result;
result =
System.Runtime.InteropServices.Marshal.ReleaseComObject(WorkBookObj);
// do
// {
// result =
System.Runtime.InteropServices.Marshal.ReleaseComObject(WorkBookObj);
// }
// while( result == 0);
ComObj = null;
}
How can I solve this problem
Thank you
Leeor Chernov
R&D Department
SPLSoftware LTD.
ISRAEL