C# 检索带有 CLSID 错误的组件的 COM 类工厂:8000401a
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10139834/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Retrieving the COM class factory for component with CLSID Error: 8000401a
提问by gofor.net
from last so many times I am getting the below error.As I am using the Microsoft Word dlls to create word files which further attached to the mail.
从上次开始,我收到以下错误。因为我正在使用 Microsoft Word dll 创建进一步附加到邮件的 Word 文件。
Server Error in '/' Application.
Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 8000401a.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 8000401a.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[COMException (0x8000401a): Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 8000401a.]
iPortal.user.sendRAMail.GetData(Object fileName) in XXX:512
iPortal.user.sendRAMail.btnSend_Click(Object sender, EventArgs e) in XXX:1300
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +107
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3436
Version Information: Microsoft .NET Framework Version:2.0.50727.4216; ASP.NET Version:2.0.50727.4223
can anybody please suggest me any solution.As I am also got some solutions that say me to change the access permission for the Word dlls using the DCOMCNFGbut still getting the same error.but on some time it works properly...so I think the code is not an issue.
And also how I will find which account is using my current application.(ex.Network Service, Administrator etc)
任何人都可以给我建议任何解决方案。因为我也有一些解决方案说我使用 更改 Word dll 的访问权限DCOMCNFG但仍然出现相同的错误。但在某些时候它可以正常工作......所以我认为代码不是问题。还有how I will find which account is using my current application.(例如网络服务、管理员等)
采纳答案by gofor.net
I found the solution,
我找到了解决方案,
using DCOMCNFG.exe open it and go to Component Service ->Computers->My Computer->DCOM Config-> check for Microsoft Office Word option and select tab Security.Here you will get the options for Launch and Activation Permission->select Customize and click on edit and the add the user that will runs your Application with full access.
使用 DCOMCNFG.exe 打开它并转到组件服务 -> 计算机 -> 我的电脑 -> DCOM 配置 -> 检查 Microsoft Office Word 选项并选择选项卡 Security.Here 您将获得启动和激活权限的选项 -> 选择自定义并单击编辑并添加将运行具有完全访问权限的应用程序的用户。
That's all ,this resolve my problem hop this will help.
就是这样,这解决了我的问题,这会有所帮助。
回答by Micah Armantrout
My idea would be to get rid of Com all together if I can find a better solution I would use it
如果我能找到更好的解决方案,我的想法是一起摆脱 Com
Check this out
看一下这个
回答by dellyjm
One thing I did on my server was to open Microsoft Word on the machine and this seemed to cause the error to go away.
我在服务器上做的一件事是在机器上打开 Microsoft Word,这似乎导致错误消失。
回答by Mohsen Meshkini
you can create another user , then login with that and create remote to 121.0.0.1 and main user (loopback to rpc!!!) then diconnect from new user and you will have interactive user
您可以创建另一个用户,然后使用该用户登录并创建远程到 121.0.0.1 和主用户(回送至 rpc !!!)然后从新用户断开连接,您将拥有交互式用户

