COM异常0x800A11F9 - 无法激活应用程序 [英] COM Exception 0x800A11F9 - Cannot activate application

查看:745
本文介绍了COM异常0x800A11F9 - 无法激活应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个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服务启动的。



如果确实如此,您需要在登录标签中更改服务使用的用户帐户

编辑:您可能想尝试将激活Word的代码放入 COM +组件,并配置组件的标识,使其在用户帐户下运行,启动Word。


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 - 无法激活应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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