Marshal.GetActiveObject(QUOT; Outlook.Application")以高特权调试时抛出MK_E_UNAVAILABLE [英] Marshal.GetActiveObject("Outlook.Application") throws MK_E_UNAVAILABLE when debugging with elevated privileges
问题描述
本无当Visual Studio是不是开始作为一个管理员发布ř调试问题的代码运行。
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.
推荐答案
我猜你正在运行Outlook时被开辟为用户,谁是记录在登录Windows下Visual Studio中以管理员身份(通过运行开始作为管理员)。因此,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(QUOT; Outlook.Application")以高特权调试时抛出MK_E_UNAVAILABLE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!