Desactivar Visual Studio Adjuntar advertencia de seguridad al depurar IIS


Cuando se utiliza Visual Studio 2008 o 2010, cada vez que se conecta a IIS w3wp.exe obtienes una Advertencia de seguridad Adjunta,

¿Cómo se convierte esto de?

Sería genial saber también, cómo mantenerlo unido para quedarse, ya que esto parece tiempo fuera después de un tiempo.

Por cierto: Agregué esto como un comentario a la respuesta a continuación, lo primero que hice fue probar el artículo de msdn http://msdn.microsoft.com/en-us/library/ms241736.aspx pero eso no funciona.

Author: Leniel Maccaferri, 2009-09-12

11 answers

También se encuentra en el artículo mencionado por Tzury, pero para resumir las respuestas en este hilo:

Asegúrese de que Visual Studio no se esté ejecutando al cambiar la clave del registro o se sobrescribirá al salir con el valor anterior

Cambie (o cree) la siguiente clave de registro a 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 Estudio 2013 HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\Debugger\DisableAttachSecurityWarning

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

Para VS2015, es posible que deba crear la Clave de registro a la que se hace referencia anteriormente.

  1. Asegúrese de que Visual Studio no se esté ejecutando y abra el Editor del Registro.
  2. Vaya a HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\14.0\Debugger, haga clic derecho y cree un nuevo DWORD:
    • Nombre: DisableAttachSecurityWarning
    • Valor: 1.

Actualizar: Si no quieres abrir regedit, guarda esto gist como un *.reg archive y ejecútelo (importa las claves para todas las versiones VS inferiores a VS2017).

Visual Studio 2017

La configuración se guarda en una ubicación de registro privado, consulte esta respuesta: https://stackoverflow.com/a/41122603/67910

Para VS 2017 , guarde este gist como un archivo*. ps1 y ejecútelo como administrador, o copie y pegue el siguiente código en un archivo 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
}
 223
Author: Wiebe Tijsma,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-05-22 14:08:12

La configuración del registro funciona; sin embargo, debe asegurarse de configurarla en el sandbox del registro de 32 bits para VS2005/2008 utilizando el regedit de 32 bits.exe en %windir%\SysWOW64\ o añadiéndolo bajo HKLM\Software\Wow6432Node\.... Creé una.script reg que simplemente lo agrega a ambos:

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

Simplemente cambie la versión a 8.0 para 2005, 10.0 para 2010, etc.

NOTA: regedit en Windows 7 parece querer .reg archivos guardados como UTF16-LE, por lo que si lo guarda en un .archivo reg, tenga en cuenta que necesita hacer eso.

 13
Author: Chris R. Donnelly,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2010-09-03 03:22:42

Pude hacerlo funcionar en Windows 7. Primero he cambiado el valor del registro con VS2008 todavía abierto. Luego lo cerré y actualizé el editor del registro y noté que el valor se restableció a 0. Luego lo cambié de nuevo a 1 y comencé VS2008. Ahora funciona bien. He intentado cerrar VS2008 y abrirlo de nuevo y el valor del registro permanece 1. Gracias por su ayuda

 8
Author: Eric Villemure,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-08-14 18:07:40

Las otras respuestas en este post contienen la información correcta, pero tuve problemas para que funcionara, por lo que este es un intento de hacer la respuesta muy explícita. Estas instrucciones funcionaron para Visual Studio 2010 que se ejecuta en Windows 7 Ultimate de 64 bits.

  • Asegúrese de que no se estén ejecutando instancias de Visual Studio (Use el administrador de tareas para verificar devenv.exe)
  • Agregue el valor de registro DWORD DisableAttachSecurityWarning a HKEY_CURRENT_USER \ Software \ Microsoft \ VisualStudio \ X. X \ Debugger y establecer el valor para ser 1. Para Visual Studio 2008 reemplace X. X con 9.0, para 2010 utilizar 10.0

La razón por la que luché para que esto funcionara fue que lo estaba intentando usando HKEY_LOCAL_MACHINE en lugar de HKEY_CURRENT_USER. Tuve que recurrir al uso de Process Monitor y un poco de filtrado en devenv para identificar mi error. Sospecho que el valor HKLM solo tiene algún efecto si se configura antes de abrir Visual Studio por primera vez.

Cualquier instancia abierta de Visual Studio sobrescribirá sus cambios cuando se cierren y solo las nuevas instancias recogerán la configuración en cualquier caso.

El uso del registro Wow6432Node parece innecesario por lo que puedo decir. Los siguientes comandos de Powershell aplicarán los pasos para 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
 6
Author: Martin Hollingsworth,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-11-06 19:55:59

Puede cambiar la identidad de iis AppPool a su usuario de Windows real, si se trata de una máquina local.

 6
Author: Tóth Zoltán,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-05-11 18:43:42

Su respuesta está disponible en http://msdn.microsoft.com/en-us/library/ms241736.aspx

Si está depurando un escenario que hace que esta advertencia aparece, y quiere suprimirlo, allí es una configuración de registro que le permite para hacer esto. Recuerde volver a activar el advertencia después de haber terminado con el escenario.

 4
Author: Tzury Bar Yochay,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2009-09-12 11:54:39

Esta no es una respuesta directa a la pregunta, pero elude el mensaje de seguridad y también proporciona una forma más rápida de adjuntar a un proceso previamente adjunto:

  • instalar Volver a conectar la extensión
  • adjunte usando Reattach y el mensaje se omite
  • volver a conectar (Ctrl-R + Ctrl-[1-5]) a un proceso anterior tiene el mismo beneficio
 4
Author: Alexei,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-03-18 21:08:34

Variante de Powershell ...reemplace $vsversion con la versión a la que desea aplicarlo.

Nota: Guarda tu trabajo antes de ejecutar esto. Se detendrán todas las instancias VS en ejecución. Si no finaliza open VS instances, el valor no se conservará.

$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
 3
Author: SliverNinja - MSFT,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-02-25 19:39:21

Entonces, lo único que funcionaría para mí con Visual Studio 2010 en x64/Win7 es actualizar ambos nodos, incluido el 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
 2
Author: Shawn Cicoria - MSFT,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-04-11 14:40:34

Una extensión de Visual Studio está disponible para VS2015 y VS2017: "Adjuntar A Todas las Cosas":

introduzca la descripción de la imagen aquí

Puede enlazar "Adjuntar a IIS" a cualquier acorde de clave que desee utilizando el proceso habitual.

 1
Author: Marc Gravell,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-02-01 16:55:13

A powershell variación basada en respuestas existentes de SliverNinja y Martin Hollingsworth. Esto se ha probado con Visual Studio 2015 en un entorno win7/x64. El script le pedirá que cierre Visual Studio si se está ejecutando (no intentará matarlo).

$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!"
}
 0
Author: Cebe,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-06-09 09:47:48