When we try to close excel object, it fails to close to cluster environment. The same is working fine in QA and UAT environment.
public bool KillExcelProcess()
{
try
{
object misValue = System.Reflection.Missing.Value;
wbObj.Save();
wbObj.Close(true, misValue, misValue);
appC.Workbooks.Close();
appC.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject(objSheet);
System.Runtime.InteropServices.Marshal.ReleaseComObject(wbObj);
System.Runtime.InteropServices.Marshal.ReleaseComObject(appC);
wbObj = null;
appC = null;
}
catch (Exception ex)
{
//throw ex;
}
finally
{
System.Threading.Thread.Sleep(5000);
GC.Collect();
}
return true;
Calling function
#endregion
try
{
log.Info("CloseExcelService (MeasureSavingsComputeBO) Starts ...");
exConverter.KillExcelProcess();
while (true)
{
try
{
File.Delete(strFilename);
break;
}
catch (Exception ex)
{
}
}