COMException(0x800A13E9)-Word互操作服务 [英] COMException (0x800A13E9) - Word interop services

查看:159
本文介绍了COMException(0x800A13E9)-Word互操作服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在获取此堆栈跟踪:

I am getting this stacktrace:

System.Runtime.InteropServices.COMException (0x800A13E9): Word ðú÷ì ááòéä.
   at Microsoft.Office.Interop.Word.Documents.Add(Object& Template, Object& NewTemplate, Object& DocumentType, Object& Visible)
   at Crm.DocumentGeneration.Printing.DocumentsPrinter.MergeDocuments(ApplicationClass& wordApp, IEnumerable`1 printDataItems, String tempDirectory, String template) in C:\Work\Danel.Nursing\Crm.DocumentGeneration.Printing\DocumentsPrinter.cs:line 249

在进行一些谷歌搜索之后,似乎COMException(0x800A13E9)内存不足异常,但是服务器上有足够的内存来启动一艘宇宙飞船 8192宇宙飞船.
这是函数调用:

After googling a bit it seems that COMException (0x800A13E9) is out of memory exception but there is enough memory on the server to launch a spaceship 8192 spaceships.
Here is the function call:

Document document = wordApp.Documents.Add(ref defaultTemplate, ref missing, ref missing, ref missing);

我检查了defaultTemplate的值是否为null或无效.

Nothing is null or invalid with defaultTemplate, I checked.

推荐答案

这是我找到的解决方案:

Here's the solution I found:

  1. 在C:\ Windows \ SysWOW64 \ config \ systemprofile上放置一个名为Desktop的文件夹(是的,我知道.WTF吗?)
  2. 打开Regedit,转到HKEY_LOCAL_MACHINE \ SOFTWARE \ Classes \ AppId并编辑两个Guid以46结尾的输入.删除它们拥有的每个键,并添加一个名为RunAs的新键,其值为Interactive User

之后,开始祈祷. 如果通过终端服务器访问,则无法使用.这对我来说是个问题,呵呵.

After that, start praying. It doesn't work if you access through a terminal server. Which is kind of a problem for me hehe.

终端服务器的问题在于,只有管理员才可以引发COM对象,因此您必须模仿管理员.

The problem with the terminal server was that only an Administrator is allowed to raise COM objects so what you have to do is impersonate to an Administrator.

这篇关于COMException(0x800A13E9)-Word互操作服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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