visual-studio Visual Studio 需要在 Windows 7 中提升权限

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2745085/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 11:53:50  来源:igfitidea点击:

Visual Studio requires elevated permissions in Windows 7

asp.netvisual-studiowindows-7permissions

提问by dev.e.loper

I'm running Visual Studio 2008 on Windows 7. When I try to attach to a process, VS tells me to restart under different credentials (with elevated permissions).

我在 Windows 7 上运行 Visual Studio 2008。当我尝试附加到进程时,VS 告诉我在不同的凭据下重新启动(具有提升的权限)。

So I have to restart VS and run it as Administrator. Is there a way to set it up so VS always starts with Admin privileges?

所以我必须重新启动 VS 并以管理员身份运行它。有没有办法设置它,以便 VS 始终以管理员权限启动?

alt text

替代文字

回答by Alex

shortcut Properties-> Compatibilitytab -> set Run this program as an administratorcheckmark.

快捷方式Properties->Compatibility选项卡 -> 设置复选Run this program as an administrator标记。

[run as administrator]

[ 以管理员身份运行]

Shajiin comments posted How to Run a Program as an Administrator in Windows 7article link.

Shaji在评论中发布了How to Run a Program as an Administrator in Windows 7文章链接。

Most useful(as for me) is to use keyboard shortcut CTRL+Shiftwhile opening the program.

最有用的(对我而言)是在打开程序时使用键盘快捷键CTRL+ Shift

回答by Jaymz

Personally (and I don't want to start a religious war on either side here), on any development rig, I always disable UAC. Then, on your test machine, ensure UAC is on and test as normal.

就个人而言(我不想在任何一方开始一场宗教War),在任何开发平台上,我总是禁用 UAC。然后,在您的测试机器上,确保 UAC 已打开并正常测试。

During development, there are an awful lot of tasks which require admin rights, so it's generally easier to just disable UAC.

在开发过程中,有很多需要管理员权限的任务,因此通常禁用 UAC 会更容易。

回答by BALKANGraph

If you always run Visual Studio as an administrator you are going to get the User Access Control warning every time you start it, even if you are logged in as an administrator to Windows. Obviously you can just click ‘OK' to dismiss this warning, but it may tempt you to turn User Access Control off.

如果您始终以管理员身份运行 Visual Studio,则每次启动时都会收到用户访问控制警告,即使您以管理员身份登录到 Windows。显然,您只需单击“确定”即可解除此警告,但您可能会想关闭用户访问控制。

Note that this is true only if Vista's User Account Control (UAC) is turned on. Many developers turn UAC off, and in this case Vista behaves in the same way as earlier versions of Windows with regard to starting Visual Studio: if you are logged in as an administrator then Visual Studio will by default run with administrative privileges.

请注意,只有在打开了 Vista 的用户帐户控制 (UAC) 时,这才是正确的。许多开发人员关闭了 UAC,在这种情况下,Vista 在启动 Visual Studio 方面的行为与早期版本的 Windows 相同:如果您以管理员身份登录,则默认情况下 Visual Studio 将以管理权限运行。

The Administrator Account

管理员帐户

Vista also has an account called ‘Administrator' which behaves differently from other administrator accounts. In fact it behaves like administrator accounts in earlier versions of Windows, in that all programs launched when using it run with administrator privileges by default. There's no need to specifically set up the program as described above.

Vista 还有一个名为“管理员”的帐户,它的行为与其他管理员帐户不同。事实上,它的行为类似于早期版本的 Windows 中的管理员帐户,因为默认情况下,使用它启动的所有程序都以管理员权限运行。无需如上所述专门设置程序。

As a developer your really shouldn't need to use this account: you can develop with administrator privileges using the techniques described in this article.

作为开发人员,您确实不需要使用此帐户:您可以使用本文中描述的技术以管理员权限进行开发。

However you may have occasions when you aren't sure whether a program is failing because of some coding error or simply because a process is being launched with insufficient privileges. In these cases it may be useful to use the Administrator account temporarily to simply rule out a problem with privileges. Note that if you work for a large organization they are almost certainly not going to let you near this account, however: this is really only useful for those developing at home.

但是,有时您可能不确定某个程序是否因为某些编码错误而失败,或者仅仅是因为正在启动的进程权限不足。在这些情况下,暂时使用管理员帐户来简单地排除权限问题可能会很有用。请注意,如果您为大型组织工作,他们几乎肯定不会让您接近此帐户,但是:这实际上仅对在家开发的人有用。

Using the Administrator Account

使用管理员帐户

To enable the Administrator account start a command prompt with administrator privileges as described above (type ‘cmd' in the Start Search box and hit Control-Shift-Enter). Then enter:

要启用管理员帐户,请使用上述管理员权限启动命令提示符(在“开始搜索”框中键入“cmd”并按 Control-Shift-Enter)。然后输入:

net user Administrator /active:yes

网络用户管理员 /active:yes

This has a blank password by default. To set a password use:

默认情况下,此密码为空。要设置密码,请使用:

net user Administrator {password}

网络用户管理员 {password}

You can now log off and log on as the Administrator. Once you are done with any testing you should disable this account again as below

您现在可以注销并以管理员身份登录。完成任何测试后,您应该再次禁用此帐户,如下所示

net user Administrator /active:no

网络用户管理员 /active:no

Note that disabling the account does not clear the password. However if you forget it you can always set it again as above when you come to use the account again (provided you have access to at least one account with administrator privileges).

请注意,禁用帐户不会清除密码。但是,如果您忘记了它,您可以在再次使用该帐户时按上述方法重新设置(前提是您至少可以访问一个具有管理员权限的帐户)。

Hope this helps...

希望这可以帮助...

s

回答by Mohamed El-Qassas MVP

This error occurs because of The current user didn't have a sufficient privilege to open Visual Studio.

发生此错误的原因是当前用户没有足够的权限打开 Visual Studio。

To overcome this issue by right-clicking on visual studio and select run as administrator at every time you intend to open it

要解决此问题,请右键单击 Visual Studio 并在每次打算打开它时选择以管理员身份运行

Also, you can check the compatibility troubleshooting

此外,您可以检查兼容性故障排除

  • Right Click on Visual Studio > Select Troubleshoot compatibility.
  • Select Troubleshoot Program.
  • Check The program requires additional permissions.
  • Click on Test the program.
  • Wait for a moment till the program launch.Click Next.
  • Select Yes, save these settings for this program.
  • Wait for resolving the issue.
  • Make sure the final status is fixed.Click Close.
  • 右键单击 Visual Studio > 选择兼容性疑难解答。
  • 选择疑难解答程序。
  • 检查程序需要额外的权限。
  • 单击测试程序。
  • 稍等片刻,直到程序启动。单击下一步。
  • 选择是,为此程序保存这些设置。
  • 等待解决问题。
  • 确保最终状态是固定的。单击关闭。

To find the detail steps for How to apply that check this link

要找到如何申请的详细步骤,请检查此链接

https://blog.devoworx.net/2016/01/06/this-task-requires-the-application-to-have-elevated-permissions/

https://blog.devoworx.net/2016/01/06/this-task-requires-the-application-to-have-elevated-permissions/

Hope it helps you

希望对你有帮助

回答by Farouq

Right click on the project -> Properties -> Debug, then change Launch to IIS Express, after that a new options should appear below finally check Enable SSLbox, save and that is it.

右键单击project -> Properties -> Debug,然后将 Launch 更改为IIS Express,之后最后应出现一个新选项,最后复选框Enable SSL,保存,就是这样。

回答by John Wales

In my case the root of this issue was app.manifestfile. You can try to remove it along with all its references or you can also left it in a project and tune it appropriately.

在我的情况下,这个问题的根源是app.manifest文件。您可以尝试将其连同其所有引用一起删除,或者您也可以将其留在项目中并对其进行适当调整。

回答by Kate Gregory

You only need to elevate VS when you are attaching to an elevated process. Not in general. Always launching VS with elevated permissions sounds like a real drag to me. YMMV I guess.

您只需要在附加到提升的进程时提升 VS。不是一般的。总是以提升的权限启动 VS 对我来说听起来真的很拖累。YMMV 我猜。