Programing

IIS를 디버깅 할 때 Visual Studio Attach 보안 경고 해제

crosscheck 2020. 6. 4. 18:59
반응형

IIS를 디버깅 할 때 Visual Studio Attach 보안 경고 해제


Visual Studio 2008 또는 2010을 사용할 때 IIS w3wp.exe에 연결할 때마다 보안 연결 경고가 표시됩니다.

이것을 어떻게 돌리나요?

시간이 지나면 시간이 초과되는 것처럼 보이기 때문에 오래도록 첨부 파일을 유지하는 방법도 아는 것이 좋습니다.

Btw : 아래 답변에 주석으로 이것을 추가했습니다 .MSDN 기사 http://msdn.microsoft.com/en-us/library/ms241736.aspx를 먼저 시도 했지만 작동하지 않습니다.


Tzury가 언급 한 기사에서도 발견되었지만이 스레드의 답변을 요약하면 다음과 같습니다.

레지스트리 키를 변경할 때 Visual Studio가 실행되고 있지 않은지 또는 종료시 이전 값으로 덮어 쓰여집니다.

다음 레지스트리 키를 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

비주얼 스튜디오 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

VS2015의 경우 위에서 참조한 레지스트리 키를 만들어야 할 수도 있습니다.

  1. Visual Studio가 실행되고 있지 않은지 확인하고 레지스트리 편집기를 엽니 다.
  2. 으로 이동하여 HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\14.0\Debugger마우스 오른쪽 버튼을 클릭하고 새를 만듭니다 DWORD.
    • 이름: DisableAttachSecurityWarning
    • 값 : 1.

업데이트 : regedit를 열지 않으려면이 요점 을 * .reg 파일로 저장하고 실행하십시오 (VS2017보다 낮은 모든 VS 버전의 키를 가져옵니다).

Visual Studio 2017

구성은 개인 레지스트리 위치에 저장됩니다. https://stackoverflow.com/a/41122603/67910

들어 VS 2017 이 저장 골자 는 *이 .ps1 파일로와 것은 관리자로 실행하거나 복사하여 PS1 파일에 다음 코드를 붙여 넣습니다 :

#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
}

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

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

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

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


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


The other answers in this post contain the right information but I had problems getting it to work so this is an attempt at make the answer very explicit. These instructions worked for Visual Studio 2010 running on 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 I struggled to get this working was that I was trying this using HKEY_LOCAL_MACHINE instead of HKEY_CURRENT_USER. I had to resort to using Process Monitor and a bit of filtering on devenv to identify my mistake. I suspect the HKLM value only has any affect if it gets set before you open Visual Studio for the first time.

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

The use of the Wow6432Node registry seems to be unnecessary as far as I can tell. The following Powershell commands will apply the steps for 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

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


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

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


This is not a direct answer to the question, but it circumvents the security message and also provides a faster way to attach to 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

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

Note: Save your work before running this. All running VS instances will be stopped. If you don't end open VS instances - 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

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

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

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

여기에 이미지 설명을 입력하십시오

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


SliverNinja와 Martin Hollingsworth의 기존 답변을 기반으로 파워 쉘 변형입니다. 이것은 win7 / x64 환경 에서 Visual Studio 2015 로 테스트되었습니다 . 스크립트가 실행 중이면 Visual Studio를 닫으라는 메시지가 표시됩니다 (삭제하지 마십시오).

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

참고 URL : https://stackoverflow.com/questions/1414769/turn-off-visual-studio-attach-security-warning-when-debugging-iis

반응형