简体   繁体   English

尝试在 CLIENT 上打开 PPT 文件时出现 CO_E_SERVER_EXEC_FAILURE

[英]CO_E_SERVER_EXEC_FAILURE when trying to open PPT-File on CLIENT

Please note that this is NOT about a server - component or ASP.NET.请注意,这是不是一个服务器-组件或ASP.NET。

This happens on a Client-Application (WinForms)这发生在客户端应用程序 (WinForms) 上

I try to open a PPT-File from within my application.我尝试从我的应用程序中打开一个 PPT 文件。 The following code works fine on my machine:以下代码在我的机器上运行良好:

   _ppApp = new Microsoft.Office.Interop.PowerPoint.Application();
                _ppApp.DisplayAlerts = PpAlertLevel.ppAlertsNone;
                _ppApp.SlideShowEnd += PpApp_SlideShowEnd;

But at least on the machine of one user (the first that tried to run it) the first line already throws the following exception:但至少在一个用户(第一个尝试运行它的用户)的机器上,第一行已经抛出以下异常:

Retrieving the COM class factory for component with CLSID {91493441-5A91-11CF-8700-00AA0060263B} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).由于以下错误,检索具有 CLSID {91493441-5A91-11CF-8700-00AA0060263B} 的组件的 COM 类工厂失败:80080005 服务器执行失败(来自 HRESULT 的异常:0x80080005 (CO_E_FAILVEREX))。 at System.Runtime.Remoting.RemotingServices.AllocateUninitializedObject(RuntimeType objectType) at System.Runtime.Remoting.Activation.ActivationServices.CreateInstance(RuntimeType serverType) at System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(RuntimeType serverType, Object[] props, Boolean bNewObj) at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)在 System.Runtime.Remoting.RemotingServices.AllocateUninitializedObject(RuntimeType objectType) 在 System.Runtime.Remoting.Activation.ActivationServices.CreateInstance(RuntimeType serverType) 在 System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(RuntimeType serverType, Object[] props , Boolean bNewObj) at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawl) at SystemMark .RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, Boolean nonPublic) at System.Activator.CreateInstance(Type type)在 System.Activator.CreateInstance(Type type, Boolean nonPublic) at System.Activator.CreateInstance(Type type)

I've seen this kind of error here on SO on various server-related snippets where the solution was about changing server and or service-behaviour.我已经在 SO 上的各种与服务器相关的片段上看到了这种错误,其中解决方案是关于更改服务器和/或服务行为。

But this is a pure client application causing that trouble.但这是一个纯粹的客户端应用程序,导致了这个麻烦。 The customer has a modern office installed.客户安装了现代化的办公室。 What might cause this behavior?什么可能导致这种行为?

I realise this answer comes a bit late, and perhaps you have already solved it (in that case it might at least be useful to future readers).我意识到这个答案来得有点晚,也许您已经解决了它(在这种情况下,它至少可能对未来的读者有用)。 I have had this problem today and this behaviour may be occuring because your PowerPoint and Client Application are being run with different rights.我今天遇到了这个问题,这种行为可能是因为您的 PowerPoint 和客户端应用程序以不同的权限运行。

For example, PowerPoint might be running with normal user privileges and your Client App might be running as an administrator.例如,PowerPoint 可能以普通用户权限运行,而您的客户端应用程序可能以管理员身份运行。 This will cause it to hang for a while and then result in the error you described.这将导致它挂起一段时间,然后导致您描述的错误。 The solution is to run both programs with similar privileges.解决方案是以相似的权限运行这两个程序。 So either both as admin or both as a normal user.因此,要么作为管理员,要么作为普通用户。 This prevented the error in my case which sounds very similar to yours (WPF app accessing an open PowerPoint presentation).这防止了我的情况下的错误,这听起来与您的情况非常相似(WPF 应用程序访问打开的 PowerPoint 演示文稿)。

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

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