title: "80040154 Class not registered" with Word interop from C#
body: <pre><code>try
  {
      if (lblCVName.Text != "")
      {
          object fileName = Convert.ToString(Server.MapPath("~/UploadResume")) + "\\" + lblCVName.Text;
          string ext = Path.GetExtension(Convert.ToString(fileName));
          ext = ext.ToLower();
          if (ext == ".doc" || ext == ".docx" || ext == ".rtf")
          {
              object readOnly = true;
              object isVisible = true;
              object missing = System.Reflection.Missing.Value;
              Application app = new Microsoft.Office.Interop.Word.Application();
              Document doc = app.Documents.Open(ref fileName,
                                          ref missing, ref readOnly,
                                          ref missing, ref missing, ref missing,
                                          ref missing, ref missing, ref missing,
                                          ref missing, ref missing, ref isVisible,
                                          ref missing, ref missing, ref missing);
              doc.Activate();
              doc.FreezeLayout();
              doc.WebPagePreview();
          }
          else
          {
              Response.Clear();
              string filePath = Convert.ToString(fileName);
              Response.ContentType = "application/pdf";
              Response.WriteFile(filePath);
          }
      }
  }
  catch (Exception exx)
  {
      Common.SendErrorReportToAdmin(exx.ToString(), "ucViewProfile.ascx"); Response.RedirectToRoute("Error", false);
  }
  </code></pre>
  
  <p>I am using xml conversion on server using this link <a href="http://www.microsoft.com/download/en/details.aspx?id=17985#additional-information" rel="nofollow">http://www.microsoft.com/download/en/details.aspx?id=17985#additional-information</a></p>
  
  <p>but I get an error:</p>
  
  <blockquote>
    <p>"Retrieving the COM class factory for component with CLSID
    {000209FF-0000-0000-C000-000000000046} failed due to the following
    error: 80040154 Class not registered (Exception from HRESULT:
    0x80040154 (REGDB_E_CLASSNOTREG))."</p>
  </blockquote>