C# &引用;80040154类未注册“;使用C中的单词interop#

C# &引用;80040154类未注册“;使用C中的单词interop#,c#,office-interop,C#,Office Interop,我正在使用此链接在服务器上使用xml转换 但我有一个错误: “正在检索具有CLSID的组件的COM类工厂 {000209FF-0000-0000-C000-0000000000 46}由于以下原因失败 错误:80040154类未注册(HRESULT异常: 0x80040154(REGDB_E_CLASSNOTREG))。” 计算机上是否安装了Microsoft word?您向项目中添加了它的哪个版本以及它的哪些引用?您是否已将office dll部署到服务器?它是否是word的正确版本?您需要与

我正在使用此链接在服务器上使用xml转换

但我有一个错误:

“正在检索具有CLSID的组件的COM类工厂 {000209FF-0000-0000-C000-0000000000 46}由于以下原因失败 错误:80040154类未注册(HRESULT异常: 0x80040154(REGDB_E_CLASSNOTREG))。”


计算机上是否安装了Microsoft word?您向项目中添加了它的哪个版本以及它的哪些引用?您是否已将office dll部署到服务器?它是否是word的正确版本?您需要与interop版本相同或更新的版本。(标准警告适用:Microsoft-您应该使用其他东西。)我没有在服务器上使用dll,我使用的是xml,根据此链接确定,但为什么您要实例化
Microsoft.Office.Interop.Word.Application
?我猜SDK不能与doc或rtf一起工作,只能与docx一起工作。
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);
}