Marshal.GetActiveObject(“Outlook.Application") 在使用提升的权限进行调试时抛出 MK_E_UNAVAILABLE [英] Marshal.GetActiveObject("Outlook.Application") throws MK_E_UNAVAILABLE when debugging with elevated privileges

查看:29
本文介绍了Marshal.GetActiveObject(“Outlook.Application") 在使用提升的权限进行调试时抛出 MK_E_UNAVAILABLE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当 Visual Studio 未以管理员身份启动时,此代码在 release r 调试中运行没有问题.

This code run without problem in release r debug when Visual studio isn't started as an admin.

Marshal.GetActiveObject("Outlook.Application");

但是,当我以管理员身份启动 Vs 并在调试中运行同一行时,出现以下错误:

However, when I start Vs as administrator and run the same line in debug, I get the following error:

System.Runtime.InteropServices.COMException
Operation unavailable (Exception from HRESULT: 0x800401E3 (MK_E_UNAVAILABLE))

我该如何解决这个问题.

How can I fix this.

推荐答案

我猜你是以管理员身份运行 Visual Studio(通过以管理员身份运行启动),而 Outlook 以用户身份打开,在 Windows 登录下登录.因此 Visual Studio 在与 Outlook 客户端不同的用户下运行.

I would guess that you are running Visual Studio as Administrator (started via Run as Administrator) while Outlook was opened as user, who was logged in as under Windows logon. So the Visual Studio is running under different user than Outlook client.

这篇关于Marshal.GetActiveObject(“Outlook.Application") 在使用提升的权限进行调试时抛出 MK_E_UNAVAILABLE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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