我开发了一个 C# 程序,它从 SQL Server 数据库中提取数据,然后生成包含数据的 Word 文档。我已将该程序设置为在 Windows Server 2003 机器上作为 SSIS 作业的一部分运行。该程序作为没有管理权限的用户 SQLSVC 运行。当我以 SQLSVC 身份登录并运行程序时,它会正确执行。但是,当程序作为 SSIS 作业自动运行时,它会在以下代码行冻结
Microsoft.Office.Interop.Word.Application word =
new Microsoft.Office.Interop.Word.Application();
当我强行终止进程时,会生成以下错误消息。
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 将所有可能的 DCOM 权限添加到用户 SQLSVC,但这没有帮助。还有其他可能的解决方案吗?