21

Is it possible to have the Edit and Continue option enabled on Visual Studio when debugging using Local IIS instead of IIS express?

Luuklag
  • 3,897
  • 11
  • 38
  • 57
user3489866
  • 353
  • 1
  • 4
  • 14

3 Answers3

32

Works in IIS 10.0 (Win 10):

In Administrator command line run

C:\Windows\System32\inetsrv>appcmd set apppool "DefaultAppPool" /+environmentVariables.add[@start,name='COMPLUS_ForceEnC',value='1']

(replace DefaultAppPool with app pool name you're using)

This will add tag

    <environmentVariables> 
        <add name="COMPLUS_ForceEnC" value="1" /> 
    </environmentVariables> 

into C:\Windows\System32\inetsrv\config\applicationHost.config for your app pool, so the app pool process always runs in Edit and Continue mode.

More on the COMPLUS_ForceEnC environment variable can be found here.

See also IIS Configuration Reference

Ondrej
  • 1,209
  • 1
  • 11
  • 21
  • You can also set this environment variable for the whole machine in "Control Panel > System > Advanced > Environment Variables..." or by using the powershell command: [Environment]::SetEnvironmentVariable("COMPLUS_ForceENC", "1", [System.EnvironmentVariableTarget]::Machine) – kevinpo Apr 01 '22 at 21:48
5

Based on Ondrej answer, here is a simple code to enable edit-and-continue on all your application-pools in one click:

SET "APPCMD=%systemroot%\system32\inetsrv\AppCmd.exe"
FOR /F "TOKENS=*" %%f IN ('%APPCMD% list apppool /text:name') DO %APPCMD% set apppool "%%~f" /+environmentVariables.add[@start,name='COMPLUS_ForceEnC',value='1']
PAUSE

save this code as "Enable Edit And Continue.bat" and run it (right click on the file and choose "Run as Administrator").

Enjoy!

Micha Kaufman
  • 777
  • 7
  • 11
0

IIS 10 on Windows 11:

C:\Windows\System32\inetsrv\appcmd.exe set config -section:system.applicationHost/applicationPools /+"[name='DefaultAppPool'].environmentVariables.[name='COMPLUS_ForceEnC',value='1']" /commit:apphost

Applied configuration changes to section "system.applicationHost/applicationPools" for "MACHINE/WEBROOT/APPHOST" at configuration commit path "MACHINE/WEBROOT/APPHOST"

paul-2011
  • 675
  • 10
  • 27