繁体   English   中英

在WCF中创建MS-Word 2003错误?

[英]Create MS-Word 2003 in WCF Error?

我使用MS-Word 2003 API(Microsoft.Office.Interop.Word)构建了有关报告的WCF解决方案,但出现此错误:

2010-09-17 16:31:39,218 [21] ERROR ERROR [(null)] - Error : Generate 0900000a80395799
System.Runtime.InteropServices.COMException (0x800706BA): The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
   at System.Runtime.InteropServices.CustomMarshalers.EnumeratorViewOfEnumVariant.MoveNext()
   at FactoryService.Generator.Generate(Task& task, IDfSession& mySession)
   at FactoryService.Generator.Generate(Object t)
2010-09-17 16:31:49,578 [22] ERROR ERROR [(null)] - Error generator timeout 0900000a80395799
2010-09-17 16:31:49,812 [14] ERROR ERROR [(null)] - Error : Generate 0900000a80395799
System.Runtime.InteropServices.COMException (0x800706BF): The remote procedure call failed and did not execute. (Exception from HRESULT: 0x800706BF)
   at Microsoft.Office.Interop.Word.ApplicationClass.get_Documents()
   at FactoryService.Generator.Generate(Task& task, IDfSession& mySession)
   at FactoryService.Generator.Generate(Object t)
2010-09-17 16:31:50,046 [18] ERROR ERROR [(null)] - Error : Generate 0900000a80395799
System.Runtime.InteropServices.COMException (0x800706BA): The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
   at Microsoft.Office.Interop.Word.ApplicationClass.get_Documents()
   at FactoryService.Generator.Generate(Task& task, IDfSession& mySession)
   at FactoryService.Generator.Generate(Object t)
2010-09-17 16:31:50,968 [22] ERROR ERROR [(null)] - Error generator timeout 0900000a80395799
2010-09-17 16:31:50,984 [10] ERROR ERROR [(null)] - Error : Generate 0900000a80395799
System.Runtime.InteropServices.COMException (0x800706BE): The remote procedure call failed. (Exception from HRESULT: 0x800706BE)
   at Microsoft.Office.Interop.Word.Documents.Open(Object& FileName, Object& ConfirmConversions, Object& ReadOnly, Object& AddToRecentFiles, Object& PasswordDocument, Object& PasswordTemplate, Object& Revert, Object& WritePasswordDocument, Object& WritePasswordTemplate, Object& Format, Object& Encoding, Object& Visible, Object& OpenAndRepair, Object& DocumentDirection, Object& NoEncodingDialog, Object& XMLTransform)
   at FactoryService.Generator.Generate(Task& task, IDfSession& mySession)
   at FactoryService.Generator.Generate(Object t)

我不知道为什么这个API会调用RPC服务,并且它是否支持在Web服务器上同时生成Word2003

提前致谢

不支持服务器端(没有UI)中的Word自动化,这会导致非常奇怪的问题。 您最好使用OpenXml库来创建Word文档。

不支持通过任何类型的服务使用任何Office产品,可能会违反您的许可,甚至更糟的是,纯文本不能正常工作。 这些是桌面应用程序,其编写是假设它们是由一个人在台式计算机上使用的。 在服务器上运行它们,就会违反大量的假设。

我们遇到了同样的问题,然后切换到以xml( Word Processing ML )生成Word文档。 结果很好。

但是,作为替代,您可能可以通过创建Windows服务(而非Web服务)来摆脱困境。 具有适当权限的Windows服务可能可以使用Word进程。

您还需要检查服务器上的DCOM设置: ControlPanel -> ComponentServices -> Computers -> MyComputer -> DCOM Config -> Microsoft Office Word ...,然后打开属性并检查用于运行Word的安全性和身份。

如果还有其他问题(互操作可能会出现问题),则可以找到有关注册表CLASSID等的更多帮助,但是请等到您到达那里为止(我们并没有出于任何原因而使用xslt来生成单词xml :)) 。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM