尝试使用从 Windows 服务从 VBA 调用的 PowerPoint 时出错

Error when attempting to use PowerPoint called from VBA from a Windows Service

我在 Apache 上有一个 Web 服务器 运行ning for Windows(运行 作为 Windows 服务),它使用 Flask 和 Python win32api库通过Interop库与PowerPoint进行交互。当我 运行 与 Flask 捆绑在一起的开发服务器上的站点一切正常。程序打开,我可以将我的演示文稿转换为视频。

当我尝试从 Web 服务器 运行ning 作为服务执行相同的操作时,我从 COM 层收到 Not enough memory resources are available to complete this operation 错误。我正在推动(物理)服务器的资源,在 PowerPoint 打开之前,我的 RAM 大约使用了 80%,但我既可以自己打开它,也可以通过开发 Web 服务器打开它 运行,它工作得很好。

我正在使用线程,如果重要的话,PowerPoint 将在单体应用的新线程中打开。

P.S。我知道 Microsoft 不容忍 PowerPoint 的这种应用,但是可惜他们没有提供不使用 PowerPoint 将 PowerPoint 转换为视频的方法!

Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.

If you are building a solution that runs in a server-side context, you should try to use components that have been made safe for unattended execution. Or, you should try to find alternatives that allow at least part of the code to run client-side. If you use an Office application from a server-side solution, the application will lack many of the necessary capabilities to run successfully. Additionally, you will be taking risks with the stability of your overall solution.

Considerations for server-side Automation of Office 文章中阅读更多相关信息。

您可以考虑使用专为服务器端执行而设计的任何第三方组件。另外,看看 Open XML SDK,请参阅 Welcome to the Open XML SDK 2.5 for Office

原来我不是 运行 PowerPoint 的正确 COM 标识。我使用 mmc -32 更改了它并添加了组件服务插件,然后深入到 DCOM,找到 PowerPoint Slide 并编辑属性以更改用户。一个新的错误出现了,但这超出了这个问题的范围!