问题描述
我有一个C#2.0(WinForms)项目,其中我尝试激活word 2003(word安装在系统上)。使用以下代码:
private void ActivateWord()
{
this.Activate();
if(m_WordDocument!= null)
{
try
{
m_WordDocument.Activate();
if(m_WordDocument.Application!= null)
{
m_WordDocument.Application.Visible = true;
m_WordDocument.Application.Activate();
}
}
catch(COMException comEx)
{
ShowError(this,comEx.Message,false);
}
}
}
当我的应用程序执行m_WordDocument时。 Application.Activate()我收到一个COM异常0x800A11F9。
Stacktrace:
System.Runtime.InteropServices.COMException(0x800A11F9):无法激活应用程序
Word.ApplicationClass.Activate()
at Roxit.SquitXO.GUI.DocumentCreatie.frmSelectVeld.ActivateWord()
这个问题的原因是什么?
COM错误0x800A11F9是权限问题,当一个贫困的用户(如网络服务
)尝试激活Office应用程序。
在您的情况下,问题不能来自IIS,因为你正在开发一个WinForms应用程序。相反,看起来您的应用程序是由在本地服务
或网络服务
用户帐户下运行的Windows服务启动的。
如果确实如此,您需要在登录
标签中更改服务使用的用户帐户
I have a C# 2.0 (WinForms) project in which I try to activate word 2003 (word is installed on the system). By using the following code:
private void ActivateWord()
{
this.Activate();
if (m_WordDocument != null)
{
try
{
m_WordDocument.Activate();
if (m_WordDocument.Application != null)
{
m_WordDocument.Application.Visible = true;
m_WordDocument.Application.Activate();
}
}
catch (COMException comEx)
{
ShowError(this, comEx.Message, false);
}
}
}
When my application executes m_WordDocument.Application.Activate() I receive a COM Exception 0x800A11F9.
Stacktrace:
"System.Runtime.InteropServices.COMException (0x800A11F9): Cannot activate application
at Word.ApplicationClass.Activate()
at Roxit.SquitXO.GUI.DocumentCreatie.frmSelectVeld.ActivateWord()"
What could be the cause of this problem?
COM error 0x800A11F9 is a well-known permission problem that occurs when an underprivileged user (such as Network Service
) tries to activate an Office application.
In your case, the problem can't come from IIS since you're developing a WinForms application. Rather, it looks like your app is started by a Windows service running under the Local Service
or Network Service
user account.
If that's indeed the case, you need to change the user account used by the service in the Log on
tab of the service's properties dialog box.
EDIT: You might want to try putting the code that activates Word into a COM+ component and configuring the identity of the component so it runs under a user account that can launch Word.
这篇关于COM异常0x800A11F9 - 无法激活应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!