[ACCEPTED]-Turn off Visual Studio Attach security warning when debugging IIS-iis-7

Accepted answer
Score: 240

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

Make sure Visual Studio is not running when changing the registry key or it will be overwritten on exit with the old value

Visual Studio 2019: Follow 12 these instructions, then reboot.

For older versions of Visual 11 Studio:

Change (or create) the following 10 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\VisualStudio\12.0\Debugger\DisableAttachSecurityWarning

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

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

  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.

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

Visual Studio 2017

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

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

#IMPORTANT: Must be run as admin

dir $env:LOCALAPPDATA\Microsoft\VisualStudio\15.* | % {
    New-PSDrive HKU Registry HKEY_USERS

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


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


    reg unload 'HKU\VS2017PrivateRegistry'

    Remove-PSDrive HKU
Score: 13

The registry setting does work; however, you 9 have to make sure you set it in the 32-bit 8 registry sandbox for VS2005/2008 by either 7 using the 32-bit regedit.exe in %windir%\SysWOW64\ or adding 6 it under HKLM\Software\Wow6432Node\.... I created a .reg script that 5 simply adds it to both:

Windows Registry Editor Version 5.00



Just change the version 4 to 8.0 for 2005, 10.0 for 2010, etc.

NOTE: regedit 3 on Windows 7 seems to want .reg files saved 2 as UTF16-LE, so if you save it to a .reg 1 file, be aware you need to do that.

Score: 8

I was able to make it Work on Windows 7. I 8 have first changed the registry value with 7 VS2008 still opened. I then closed it and 6 refreshed the registry editor and noticed 5 that the value was reset to 0. I then changed 4 it back to 1 and started VS2008. It now 3 works fine. I have tried to close VS2008 2 and open it back and the registry value 1 stays 1. Thanks for your help

Score: 7

The other answers in this post contain the 20 right information but I had problems getting 19 it to work so this is an attempt at make 18 the answer very explicit. These instructions 17 worked for Visual Studio 2010 running on 16 Windows 7 Ultimate 64-Bit.

  • Ensure that no instances of Visual Studio are running (Use task manager to check for devenv.exe)
  • Add the DWORD DisableAttachSecurityWarning registry value to HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\X.X\Debugger and set the value to be 1. For Visual Studio 2008 replace X.X with 9.0, for 2010 use 10.0

The reason why 15 I struggled to get this working was that 14 I was trying this using HKEY_LOCAL_MACHINE 13 instead of HKEY_CURRENT_USER. I had to resort 12 to using Process Monitor and a bit of filtering on devenv 11 to identify my mistake. I suspect the HKLM 10 value only has any affect if it gets set 9 before you open Visual Studio for the first 8 time.

Any open instances of Visual Studio 7 will overwrite your changes when they are 6 closed and only new instances would pick 5 up the setting in any case.

The use of the 4 Wow6432Node registry seems to be unnecessary as far 3 as I can tell. The following Powershell 2 commands will apply the steps for Visual 1 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
Score: 6

You can change the iis AppPool identity 2 to your actual windows user, if it is a 1 local machine.

Score: 4

your answer is available at http://msdn.microsoft.com/en-us/library/ms241736.aspx

If you are debugging 5 a legitimate scenario that causes this 4 warning to appear, and want to suppress 3 it, there is a registry setting that allows 2 you to do this. Remember to re-enable 1 the warning after you are done with the scenario.

Score: 4

This is not a direct answer to the question, but 3 it circumvents the security message and 2 also provides a faster way to attach to 1 a previously attached process:

  • install Reattach extension
  • attach using Reattach and the message is bypassed
  • re-attaching (Ctrl-R + Ctrl-[1-5]) to a previous process has the same benefit
Score: 3

Powershell variant...replace $vsversion with the version you 4 want to apply it to.

Note: Save your work before 3 running this. All running VS instances will 2 be stopped. If you don't end open VS instances 1 - the value will not be retained.

$vsversion = "12.0" # VS 2013 (optionally 11, 10, 9, etc.)
kill -name devenv # end any existing VS instances (required for persisting config change)
Get-ItemProperty -Path "HKCU:\Software\Microsoft\VisualStudio\$vsversion\Debugger" -Name DisableAttachSecurityWarning -ErrorAction SilentlyContinue # query value (ignore if not exists)
Set-ItemProperty -Path "HKCU:\Software\Microsoft\VisualStudio\$vsversion\Debugger" -Name DisableAttachSecurityWarning -Value 1 # assign value
Score: 3

A Visual Studio extension is available for 3 VS2015 and VS2017: "Attach To All The Things":

enter image description here

You can bind "Attach 2 To IIS" to whatever key chord you like 1 using the usual process.

Score: 2

so, the only thing that would work for me 2 with Visual Studio 2010 on x64/Win7 is to 1 update both nodes, including the Wow6432Node.

Windows Registry Editor Version 5.00


Score: 0

A powershell variation based on existing answers from 4 SliverNinja and Martin Hollingsworth. This 3 has been tested with Visual Studio 2015 on a win7/x64 environment. The 2 script will ask you to close Visual Studio 1 if it's running (won't try to kill it).

$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!"

More Related questions