title: opening excel error: System.Runtime.InteropServices.COMException (0x80080005): Retrieving the COM class factory for component with CLSID
body: <p>I have a C# .net web app.  I want a user to click a button on a webpage, the server to open an excel spreadsheet and write data to it, and the user to save the document.  This works locally using Visual Studio 2010 and Office 2010.  On my server, however, I get this error: </p>
  
  <blockquote>
    <p>System.Runtime.InteropServices.COMException (0x80080005): Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)). </p>
  </blockquote>
  
  <p>I have researched and found a ton of answers stating to open dcomconfig and add the user with permissions to Microsoft Excel Application.  My site is set to passthrough security so I added myself; I am an admin on the server, so I ensured Admins had access; I also added the App Pool default of Network Service; also ASP.NET Machine Account; and, just in case, added the account the app uses when connecting to the database.  I still get the exact same error.</p>
  
  <p>My server is 64 bit, Office 2007, IIS 7.  </p>
  
  <p>My code is:</p>
  
  <pre><code>    {
          try
          {
              Excel.Application xXL = null;
              Excel.Workbook xWB = null;
              Excel.Worksheet xSheet = null;
              xXL = new Excel.Application();
          }
          catch (Exception ex)
          {
              Response.Write(ex.ToString());
          }
      }
  </code></pre>