在调试IIS时关闭Visual Studio Attach安全警告 [英] Turn off Visual Studio Attach security warning when debugging IIS

查看:108
本文介绍了在调试IIS时关闭Visual Studio Attach安全警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Visual Studio 2008或2010时,每次附加到IIS w3wp.exe时都会出现附加安全警告,

When using Visual Studio 2008 or 2010, every time you attach to IIS w3wp.exe you get an Attach Security Warning,

如何解决此问题?

这也很酷,如何保持附加状态,因为这似乎会在一段时间后超时。

It would be cool to know also, how to keep it attached for linger, as this seems to time out after a while.

Btw:我在下面的答案中添加了这个评论,我做的第一件事是尝试msdn文章 http://msdn.microsoft.com/en-us/library/ms241736.aspx 但这不起作用。

Btw: I Added this as a comment to the answer below, the first thing I did was try the msdn article http://msdn.microsoft.com/en-us/library/ms241736.aspx but that doesn't work.

推荐答案

也可以在Tzury提到的文章中找到,但总结一下这个帖子中的答案:

Also found in the article mentioned by Tzury, but to sum up the answers in this thread:

确保更改注册表项时Visual Studio未运行,或者在退出时使用旧值覆盖它

更改(或创建)以下内容注册表项 1

Change (or create) the following registry key to 1:

Visual Studio 2008 < /强> HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\Debugger\DisableAttachSecurityWarning

的Visual Studio 2010 HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\Debugger\DisableAttachSecurityWarning

<强>的Visual Studio 2012
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\Debugger\DisableAttachSecurityWarning

Visual Studio 2013
HKEY_CURRENT_USER \Software \ Microsoft's\VisualStudio \ 12.0 \Debugger \DisableAttachSecurityWarning

Visual Studio 2015
HKEY_CURRENT_USER \Software\Microsoft\VisualStudio\14.0\Debugger\DisableAttachSecurityWarning

有关VS2015,你可能需要创建注册表关键参考d以上。

For VS2015, you might need to create the Registry Key referenced above.


  1. 确保Visual Studio未运行,并打开注册表编辑器。

  2. 导航到
    HKEY_CURRENT_USER \Software \ Mysoftoft\VisualStudio \14.0 \Debugger ,右键单击并创建一个新的 DWORD


    • 名称: DisableAttachSecurityWarning

    • 价值: 1

  1. Make sure Visual Studio is not running, and open the Registry Editor.
  2. Navigate to HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\14.0\Debugger, right-click and create a new DWORD:
    • Name: DisableAttachSecurityWarning
    • Value: 1.

更新:如果您不想打开注册表编辑器,保存此的 gist 作为* .reg文件并运行它(导入所有键的密钥) VS版本低于VS2017)。

Update: If you don't want to open up regedit, save this gist as a *.reg file and run it (imports the keys for all VS versions lower than VS2017).

Visual Studio 2017

配置保存在私有注册表位置,看到这个答案: https://stackoverflow.com/a/41122603/67910

The configuration is saved in a private registry location, see this answer: https://stackoverflow.com/a/41122603/67910

对于 VS 2017 ,请保存 gist 作为* .ps1文件并以管理员身份运行,或将以下代码复制并粘贴到ps1文件中:

For VS 2017, save this gist as a *.ps1 file and run it as admin, or copy and paste the following code in a ps1 file:

#IMPORTANT: Must be run as admin

dir $env:LOCALAPPDATA\Microsoft\VisualStudio\15.* | % {
    #https://stackoverflow.com/a/41122603
    New-PSDrive HKU Registry HKEY_USERS

    reg load 'HKU\VS2017PrivateRegistry\' $_\privateregistry.bin

    $BasePath='HKU:\VS2017PrivateRegistry\Software\Microsoft\VisualStudio'

    $keysResult=dir $BasePath
    $keysResult | ? {$_.Name -match '\\\d+\.\d+_[^_]+$'} | % {
        $keyName = $_.Name -replace 'HKEY_USERS','HKU:'
        New-ItemProperty -Path $keyName\Debugger -Name DisableAttachSecurityWarning -Value 1
    }
    $keysResult.Handle.Close()    

    [gc]::collect()

    reg unload 'HKU\VS2017PrivateRegistry'

    Remove-PSDrive HKU
}

这篇关于在调试IIS时关闭Visual Studio Attach安全警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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