DCOM办公自动化失败 [英] DCOM Failure of Office Automation

查看:95
本文介绍了DCOM办公自动化失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个C#程序,该程序从SQL Server数据库中提取数据,然后生成包含数据的Word文档.我已经将该程序设置为在Windows Server 2003机器上作为SSIS作业的一部分运行.该程序以没有管理特权的用户SQLSVC身份运行.当我以SQLSVC登录并运行程序时,它将正确执行.但是,当程序作为SSIS作业自动运行时,它将冻结在以下代码行中

I developed a C# program that pulls data from a SQL Server database and then generates Word documents which include the data. I've set the program up to run as part of an SSIS job on a Windows Server 2003 box. The program runs as user SQLSVC which doesn't have administrative privileges. When I log in as SQLSVC and run the program it executes correctly. However, when the program is run automatically as an SSIS job it freezes at the following line of code

Microsoft.Office.Interop.Word.Application word =
    new Microsoft.Office.Interop.Word.Application();

当我强行终止该进程时,会生成以下错误消息.

When I kill the process forcibly, the following error message is generated.

Error Message: System.Runtime.InteropServices.COMException (0x80080005):
Retrieving the COM class factory for component
with CLSID {000209FF-0000-0000-C000-000000000046}
failed due to the following error: 80080005.
   at IepGlance.Program.CreateNewIepFiles(Dictionary`2
       iepDictionary, EasyIepDataContext dbContext)
   at IepGlance.Program.Main(String[] args)

据我所知,问题出在DCOM权限上.我已经使用dcomcnfg向用户SQLSVC添加所有可能的DCOM权限,但这并没有帮助.还有其他可能的解决方案吗?

As far as I can figure out the problem is with DCOM permissions. I've used dcomcnfg to add all possible DCOM permissions to user SQLSVC, but this hasn't helped. Are there any other possible solutions?

推荐答案

运行程序"dcomcnfg -32". (如果它在64位下运行,则找不到word和excel组件) 转到控制台根目录/组件服务/计算机/我的电脑/DCOM Config/",查找Microsoft Word和Excel并选择属性. 转到安全性",然后在配置权限"下选择自定义".(如果需要,您可能还希望更改其他权限,但我不需要)添加"IIS_IUSRS"并赋予它完全控制权". 现在转到身份",然后选择交互式用户".

Run program "dcomcnfg -32". ( You cant find the word and excel components if it runs under 64bit) Go to "Console Root/Component Services/Computer/My Computer/DCOM Config/" Look up Microsoft Word and Excel and choose properties. 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".

这篇关于DCOM办公自动化失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆