Visual studio 2010 调试IIS时关闭Visual Studio附加安全警告

Visual studio 2010 调试IIS时关闭Visual Studio附加安全警告,visual-studio-2010,visual-studio,visual-studio-2008,iis,iis-7,Visual Studio 2010,Visual Studio,Visual Studio 2008,Iis,Iis 7,使用Visual Studio 2008或2010时,每次连接到IIS w3wp.exe时,都会收到一条附加安全警告 你是如何扭转这种局面的 如果知道如何保持它的连接以供逗留,那将是一件很酷的事情,因为这似乎会在一段时间后超时 顺便说一句:我在下面的答案中添加了这一点作为评论,我做的第一件事是尝试msdn文章,但这不起作用。您的答案可以在 如果您正在调试合法的 导致发出此警告的场景 出现,并想抑制它,在那里 是一个注册表设置,允许您 这样做。请记住重新启用 使用完后发出警告 情景 Tzury提到

使用Visual Studio 2008或2010时,每次连接到IIS w3wp.exe时,都会收到一条附加安全警告

你是如何扭转这种局面的

如果知道如何保持它的连接以供逗留,那将是一件很酷的事情,因为这似乎会在一段时间后超时


顺便说一句:我在下面的答案中添加了这一点作为评论,我做的第一件事是尝试msdn文章,但这不起作用。

您的答案可以在

如果您正在调试合法的 导致发出此警告的场景 出现,并想抑制它,在那里 是一个注册表设置,允许您 这样做。请记住重新启用 使用完后发出警告 情景


Tzury提到的文章中也提到了这一点,但总结一下本文中的答案:

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

Visual Studio 2019:按照以下步骤操作,然后重新启动

对于较旧版本的Visual Studio:

将以下注册表项更改(或创建)为1

Visual Studio 2008
HKEY\U CURRENT\U USER\Software\Microsoft\VisualStudio\9.0\Debugger\DisableAttacheSecurityWarning

Visual Studio 2010
HKEY\U CURRENT\U USER\Software\Microsoft\VisualStudio\10.0\Debugger\DisableAttacheSecurityWarning

Visual Studio 2012
HKEY\U CURRENT\u USER\Software\Microsoft\VisualStudio\11.0\Debugger\DisableAttacheSecurityWarning

Visual Studio 2013
HKEY\U CURRENT\u USER\Software\Microsoft\VisualStudio\12.0\Debugger\DisableAttacheSecurityWarning

Visual Studio 2015
HKEY\U CURRENT\u USER\Software\Microsoft\VisualStudio\14.0\Debugger\DisableAttacheSecurityWarning

对于VS2015,您可能需要创建上面引用的注册表项

  • 确保Visual Studio未运行,然后打开注册表编辑器
  • 导航到
    HKEY\U CURRENT\U USER\Software\Microsoft\VisualStudio\14.0\Debugger
    ,右键单击并创建新的
    DWORD
    • 名称:
      disableattachesecuritywarning
    • 值:
      1
    更新:如果不想打开regedit,请将其另存为*.reg文件并运行它(为低于VS2017的所有VS版本导入密钥)

    Visual Studio 2017

    配置保存在专用注册表位置,请参阅以下答案:

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

    #重要提示:必须以管理员身份运行
    目录$env:LOCALAPPDATA\Microsoft\VisualStudio\15.*{
    #https://stackoverflow.com/a/41122603
    新PSDrive HKU注册表HKEY_用户
    注册加载“HKU\VS2017PrivateRegistry\'$\ux\privateregistry.bin
    $BasePath='HKU:\VS2017PrivateRegistry\Software\Microsoft\VisualStudio'
    $keysResult=dir$BasePath
    $keysResult |?{$\.Name-匹配'\\\d+\.\d+\\\[^\\]+$'}\%{
    $keyName=$\u.Name-替换“HKEY\U用户”,“HKU:”
    New ItemProperty-Path$keyName\Debugger-Name DisableAttachSecurityWarning-Value 1
    }
    $keysResult.Handle.Close()
    [gc]::collect()
    注册卸载“香港大学\VS2017PrivateRegistry”
    卸下PSDrive HKU
    }
    
    我能够在Windows7上运行它。我首先在VS2008仍然打开的情况下更改了注册表值。然后我关闭它并刷新注册表编辑器,注意到该值被重置为0。然后我将其改回1并启动VS2008。它现在运行良好。我尝试关闭VS2008并将其打开,注册表值保持为1。感谢您的帮助

    注册表设置确实有效;但是,您必须确保使用
    %windir%\SysWOW64\
    中的32位regedit.exe或将其添加到
    HKLM\Software\Wow6432Node\…
    下,在VS2005/2008的32位注册表沙盒中进行设置。我创建了一个.reg脚本,只需将其添加到以下两个脚本中:

    Windows Registry Editor Version 5.00
    
    [HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\Debugger]
    "DisableAttachSecurityWarning"=dword:00000001
    
    [HKEY_CURRENT_USER\Software\Wow6432Node\Microsoft\VisualStudio\9.0\Debugger]
    "DisableAttachSecurityWarning"=dword:00000001
    
    只需将2005年的版本更改为8.0,2010年的版本更改为10.0,等等


    注意:Windows 7上的regedit似乎希望将.reg文件保存为UTF16-LE,因此如果将其保存为.reg文件,请注意您需要这样做。

    本文中的其他答案包含正确的信息,但我在使其工作时遇到问题,因此这是一次尝试,旨在使答案非常明确。这些说明适用于在Windows 7 Ultimate 64位上运行的Visual Studio 2010

    • 确保没有Visual Studio实例正在运行(使用任务管理器检查devenv.exe
    • 将DWORDDisableAttachSecurityWarning注册表值添加到HKEY\U CURRENT\U USER\Software\Microsoft\VisualStudio\X.X\Debugger,并将该值设置为1。对于Visual Studio 2008,将X.X替换为9.0,对于2010,使用10.0
    我之所以很难做到这一点,是因为我尝试使用HKEY_LOCAL_机器,而不是HKEY_CURRENT_用户。我不得不在devenv上使用和过滤来识别我的错误。我怀疑HKLM值只有在您第一次打开Visual Studio之前设置时才有任何影响

    任何打开的VisualStudio实例在关闭时都将覆盖您的更改,并且在任何情况下,只有新实例才会选择该设置

    据我所知,使用登记册似乎是没有必要的。以下Powershell命令将应用Visual Studio 2010的步骤

    Get-Process -Name devenv* | ForEach-Object { Stop-Process $_.Id }
    New-ItemProperty -Path 'HKCU:\Software\Microsoft\VisualStudio\10.0\Debugger' -Name 'DisableAttachSecurityWarning' -Value 1 -PropertyType 'DWORD' -Force
    

    因此,在x64/Win7上使用Visual Studio 2010对我来说唯一有效的方法就是更新两个节点,包括WOW6432节点

    Windows Registry Editor Version 5.00
    
    [HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\Debugger]
    "DisableAttachSecurityWarning"=dword:00000001
    
    [HKEY_CURRENT_USER\Software\Wow6432Node\Microsoft\VisualStudio\10.0\Debugger]
    "DisableAttachSecurityWarning"=dword:00000001
    

    如果iis AppPool是本地计算机,则可以将其标识更改为您的实际windows用户。

    Powershell变体…替换
    $vsversion
    
    $vsversion = "14.0" # VS 2015 (optionally 12, 11, 10, 9, etc...)
    $disable = 1 # set to 0 to enable the warning message
    
    # not using Get-Process here because powershell instance can be 64 bit and devenv is 32 bit
    if (!(get-wmiobject win32_process -filter "name='devenv.exe'")) {
        # Create or (force) update the property
        New-ItemProperty -Path "HKCU:\Software\Microsoft\VisualStudio\$vsversion\Debugger" -Name DisableAttachSecurityWarning -Value $disable -PropertyType 'DWORD' -Force
        Write-Host Done!
    }
    else {
        Write-Error "Please close Visual Studio first!"
    }