title: C# error when read Excel file, this is a strange error
body: <p>When I read (*.xls) file in C# I get an error. </p>
  
  <p>I see lots of topic about "DCOM Access Denied Problem" and configuration of related problem in SO, but non of them solved my problem. all permission and administrator account was checked.  this is image of error:</p>
  
  <p>Update: this is logged error by app :</p>
  
  <pre><code>Error       : The remote procedure call failed. (Exception from HRESULT: 0x800706BE)
  Stack Trace : at Microsoft.Office.Interop.Excel.Workbooks.Open(String Filename, Object UpdateLinks, Object ReadOnly, Object Format, Object Password, Object WriteResPassword, Object IgnoreReadOnlyRecommended, Object Origin, Object Delimiter, Object Editable, Object Notify, Object Converter, Object AddToMru, Object Local, Object CorruptLoad)
     at Pardic.WebProcess.frmGetPrice.worker_DoWork(Object sender, DoWorkEventArgs e)
  ^^-------------------------------------------------------------------^^
  Source      : Microsoft.Office.Interop.Excel
  Method      : Quit
  Date        : 02:21:19 ب.ظ
  Time        : 07/03/1398
  Computer    : DESKTOP-2QPBGQ1
  Error       : Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
  Stack Trace : at Microsoft.Office.Interop.Excel.ApplicationClass.Quit()
     at Pardic.WebProcess.frmGetPrice.worker_DoWork(Object sender, DoWorkEventArgs e)
  </code></pre>
  
  <p>This is Event Windows logs:</p>
  
  <pre><code>Log Name:      Application
  Source:        Application Error
  Date:          5/28/2019 2:16:11 PM
  Event ID:      1000
  Task Category: (100)
  Level:         Error
  Keywords:      Classic
  User:          N/A
  Computer:      DESKTOP-2QPBGQ1
  Description:
  Faulting application name: EXCEL.EXE, version: 15.0.4420.1017, time stamp: 0x506741b5
  Faulting module name: ntdll.dll, version: 10.0.14393.2214, time stamp: 0x5ac2f612
  Exception code: 0xc0000005
  Fault offset: 0x000000000004961c
  Faulting process id: 0x1934
  Faulting application start time: 0x01d5153a29e7eeb5
  Faulting application path: C:\Program Files\Microsoft Office\Office15\EXCEL.EXE
  Faulting module path: C:\Windows\SYSTEM32\ntdll.dll
  Report Id: 9910317c-cd4c-49b2-8869-76f88b722123
  Faulting package full name: 
  Faulting package-relative application ID: 
  Event Xml:
  &lt;Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event"&gt;
    &lt;System&gt;
      &lt;Provider Name="Application Error" /&gt;
      &lt;EventID Qualifiers="0"&gt;1000&lt;/EventID&gt;
      &lt;Level&gt;2&lt;/Level&gt;
      &lt;Task&gt;100&lt;/Task&gt;
      &lt;Keywords&gt;0x80000000000000&lt;/Keywords&gt;
      &lt;TimeCreated SystemTime="2019-05-28T09:46:11.052916900Z" /&gt;
      &lt;EventRecordID&gt;20076&lt;/EventRecordID&gt;
      &lt;Channel&gt;Application&lt;/Channel&gt;
      &lt;Computer&gt;DESKTOP-2QPBGQ1&lt;/Computer&gt;
      &lt;Security /&gt;
    &lt;/System&gt;
    &lt;EventData&gt;
      &lt;Data&gt;EXCEL.EXE&lt;/Data&gt;
      &lt;Data&gt;15.0.4420.1017&lt;/Data&gt;
      &lt;Data&gt;506741b5&lt;/Data&gt;
      &lt;Data&gt;ntdll.dll&lt;/Data&gt;
      &lt;Data&gt;10.0.14393.2214&lt;/Data&gt;
      &lt;Data&gt;5ac2f612&lt;/Data&gt;
      &lt;Data&gt;c0000005&lt;/Data&gt;
      &lt;Data&gt;000000000004961c&lt;/Data&gt;
      &lt;Data&gt;1934&lt;/Data&gt;
      &lt;Data&gt;01d5153a29e7eeb5&lt;/Data&gt;
      &lt;Data&gt;C:\Program Files\Microsoft Office\Office15\EXCEL.EXE&lt;/Data&gt;
      &lt;Data&gt;C:\Windows\SYSTEM32\ntdll.dll&lt;/Data&gt;
      &lt;Data&gt;9910317c-cd4c-49b2-8869-76f88b722123&lt;/Data&gt;
      &lt;Data&gt;
      &lt;/Data&gt;
      &lt;Data&gt;
      &lt;/Data&gt;
    &lt;/EventData&gt;
  &lt;/Event&gt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/V1ctd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/V1ctd.png" alt="enter image description here"></a></p>
  
  <p><strong>and this is list of installed program:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/KIN6q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KIN6q.png" alt="enter image description here"></a>
  <a href="https://i.stack.imgur.com/mywSA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mywSA.png" alt="enter image description here"></a></p>
  
  <pre><code>    public static System.Collections.Generic.List&lt;Pardic.DataAwareCtrls.Progress.InsuranceDrugInfo&gt; ReadResult(string fileAddress)
          {
              List&lt;Pardic.DataAwareCtrls.Progress.InsuranceDrugInfo&gt; retList = new List&lt;Pardic.DataAwareCtrls.Progress.InsuranceDrugInfo&gt;();
              Microsoft.Office.Interop.Excel.Application oXL;
              oXL = new Microsoft.Office.Interop.Excel.Application();
              try
              {
                  Microsoft.Office.Interop.Excel.Workbook theWorkbook = oXL.Workbooks.Open(fileAddress);
                  Microsoft.Office.Interop.Excel.Sheets sheets = theWorkbook.Worksheets;
                  Microsoft.Office.Interop.Excel.Worksheet worksheet = (Microsoft.Office.Interop.Excel.Worksheet)sheets.get_Item(1);
                  foreach (Microsoft.Office.Interop.Excel.Worksheet item in sheets)
                  {
                      if (item.Name.Contains("Main"))
                      {
                          Microsoft.Office.Interop.Excel.Range ShtRange = item.UsedRange;
                          int CodeColumnNum = 0;
                          int PriceColumnNum = 0;
                          int NameColumnNum = 0;
                          int num = 0;
                          for (num = 1; num &lt;= ShtRange.Columns.Count; num++)
                          {
                              try
                              {
                                  string temp = string.Empty;
                                  try
                                  {
                                      temp = ShtRange.Cells[1, num].Value2.ToString();
                                  }
                                  catch
                                  {
                                      temp = string.Empty;
                                  }
                                  if (temp.Contains("كد دارو"))
                                      CodeColumnNum = num;
                                  if (temp.Contains("تغيير قيمت"))
                                      PriceColumnNum = num;
                                  if (temp.Contains("نام دارو"))
                                      NameColumnNum = num;
                              }
                              catch (Exception ex)
                              {
                                  if (CodeColumnNum &gt; 0 &amp;&amp; PriceColumnNum &gt; 0 &amp;&amp; NameColumnNum &gt; 0)
                                      break;
                                  oXL.Quit();
                                  throw ex;
                              }
                          }
  
                          for (num = 2; num &lt;= ShtRange.Rows.Count; num++)
                          {
                              Pardic.DataAwareCtrls.Progress.InsuranceDrugInfo drug = new Pardic.DataAwareCtrls.Progress.InsuranceDrugInfo();
                              string Codetemp = string.Empty;
                              try
                              {
                                  Codetemp = ShtRange.Cells[num, CodeColumnNum].Value2.ToString();
                              }
                              catch
                              {
                                  Codetemp = string.Empty;
                              }
                              string Pricetemp = string.Empty;
                              try
                              {
                                  Pricetemp = ShtRange.Cells[num, PriceColumnNum].Value2.ToString();
                              }
                              catch
                              {
                                  Pricetemp = string.Empty;
                              }
                              drug.Drug_Code = CodeAnalize(Codetemp);
                              drug.Drug_Price = PriceAnalize(Pricetemp);
                              drug.Drug_Name = ShtRange.Cells[num, NameColumnNum].Value2;
                              if (drug.Drug_Price != string.Empty &amp;&amp; drug.Drug_Code != string.Empty)
                                  retList.Add(drug);
                          }
                      }
                  }
  
               theWorkbook.Save();
                  return retList; 
              }
              catch //(Exception ex)
              {
                  return null;
              }
              finally
              {
                  oXL.Quit();
              }
          }
  </code></pre>
  
  <p><strong>this problem is appears when I reinstall windows and office. installation office is 2013 (both office and win are 64 bit)</strong> </p>
  
  <p>Update:</p>