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

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

问题描述

我得到这个堆栈跟踪:

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:WorkDanel.NursingCrm.DocumentGeneration.PrintingDocumentsPrinter.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:WindowsSysWOW64configsystemprofile 上放置一个名为 Desktop 的文件夹(是的,我知道.WTF?)
  2. 打开 Regedit,转到 HKEY_LOCAL_MACHINESOFTWAREClassesAppId 并编辑 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天全站免登陆