Excel process not ending in Cluster environment

Posted by Vasanth on Stack Overflow See other posts from Stack Overflow or by Vasanth
Published on 2010-02-05T11:21:22Z Indexed on 2010/03/23 18:03 UTC
Read the original article Hit count: 290

Filed under:
|
|
|
|

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)
                {

                }
            }

© Stack Overflow or respective owner

Related posts about excel

Related posts about cluster