问题描述
我在 Visual Studio 2008 中遇到了一个 C# ASP .NET 项目的问题当我用 Windows 7 Ultimate (x64) 重新安装我的电脑时,这个问题就开始了.为此,我也在使用 Office 2007.
I have a problem with a C# ASP .NET project in Visual Studio 2008 This problem started when I reinstalled my computer with Windows 7 Ultimate (x64). To this I'm also using Office 2007.
我得到的错误信息是:
System.UnauthorizedAccessException:检索具有 CLSID {000209FF-0000-0000-C000-000000000046} 的组件的 COM 类工厂失败,原因是以下错误:80070005.在 xxx.Utility.WordDocument..ctor(字符串文件路径,HttpServerUtility util)在 c:xxxWebsitecustomercommunication.aspx.cs:line 127 中的 customer_communication.BuCreate_click(Object sender, EventArgs e) 处
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:xxxWebsitecustomercommunication.aspx.cs:line 127
推荐答案
这是我解决此问题的方法:
我使用的是 Win 7 64 位和 Office 2007
I'm using Win 7 64bit and Office 2007
运行程序dcomcnfg -32".(64位下找不到word和excel组件)
Run program "dcomcnfg -32". ( You cant find the word and excel components if it runs under 64bit)
转到控制台根目录/组件服务/计算机/我的电脑/DCOM 配置/"查找 Microsoft Word 和 Excel 并选择属性.
Go to "Console Root/Component Services/Computer/My Computer/DCOM Config/" Look up Microsoft Word and Excel and choose properties.
转到安全并选择配置权限"下的自定义".(如果需要,您可能还想更改其他权限,但我不需要)添加IIS_IUSRS"并赋予它完全控制".
Go to Security and select "Customize" under "Configuration Permissions. (If needed you might want to change the other permissions as well, but I didn't need to) Add "IIS_IUSRS" and give it "Full Control".
现在转到身份"并选择交互式用户".
Now go to "Identity" and select "The interactive user".
完成后不要忘记按确定".:D
Do not forget to press "OK" when done. :D
我希望这可以帮助您解决您的问题,以及其他到这里阅读本文的人.
I Hope this helps you with your problem and also the rest who gets here and read this.
这篇关于System.UnauthorizedAccessException:检索 Word 互操作的 COM 类工厂失败并出现错误 80070005的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!