我在 Visual Studio 2008 中遇到 C# ASP .NET 项目问题 当我用 Windows 7 Ultimate (x64) 重新安装我的计算机时,这个问题就开始了。为此,我还使用 Office 2007。
我得到的错误信息是:
System.UnauthorizedAccessException: Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80070005. at xxx.Utility.WordDocument..ctor(String filePath, HttpServerUtility util) at customer_communication.BuCreate_click(Object sender, EventArgs e) in c:\xxx\Website\customer\communication.aspx.cs:line 127
最佳答案
这是我对这个问题的修复:
我使用的是 Win 7 64 位和 Office 2007
运行程序“dcomcnfg -32”。 (64位下找不到word和excel组件)
转到“控制台根目录/组件服务/计算机/我的电脑/DCOM 配置/” 查找 Microsoft Word 和 Excel 并选择属性。
转到安全并选择“配置权限”下的“自定义”。(如果需要,您可能还想更改其他权限,但我不需要) 添加“IIS_IUSRS”并赋予它“完全控制”。
现在转到“身份”并选择“交互式用户”。
完成后不要忘记按“确定”。 :D
我希望这可以帮助您解决您的问题,也可以帮助其他来到这里阅读本文的人。
关于c# - 系统.UnauthorizedAccessException : Retrieving the COM class factory for Word Interop fails with error 80070005,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1491123/