Edit and continue in ASP.NET web projects
I know how to enable Edit and Continue in ASP.NET Web Application projects (see here), however, I found no information as to how to achieve the same thing开发者_JAVA技巧 in ASP.NET Web Site projects.
Is this feature available in Web Site projects? If no, it seems that converting our Web Site project to a Web Application is really worth doing.
With a website project edit and continue is disabled by default. To enable it you must go to: Properties->Web->'Servers' section, check 'Enable Edit and Continue'. Then, if you break your code you can edit it and continue. You cannot edit the code if you are not stepping through it. i.e. you have to break before editing.
Although you can't edit the code while stepping through with the debugger, Web Site projects allow you to simply edit the source code and then reload the page. This is almost as useful as "Edit and Continue." ASP.NET dynamic compilation allows you to change the source code which triggers the automatic recompile.
Here is a related article on Understanding ASP.NET Dynamic Compilation
This page is also useful and has a section called Comparing Web Site Projects and Web Application Projects
Edit and Continue is not supported in Web Site projects. If that is important to you I suggest going with Web Application Projects.
As they say, "it depends".
For both Visual Studio 2015 & Visual Studio 2017, if you want to be able to "Edit & Continue" in Web Projects, then you need to set the server for your project to "IIS Express" in the Web tab of Project Settings.
If you do this, you will also be able to set/hit breakpoints on the web startup code.
Just in case you need this feature working in Visual Studio 2015. This feature is still supported but with little changes in options. So, if you want continue running IIS even after debugging session is stopped in Visual Studio 2015, here's the steps you should follow:
Step 1: Tool | Options | IntelliTrace | General | Check 'Enable IntelliTrace' and select 'IntelliTrave events only' option only. Note: If you select 'IntelliTrace events and call information' then this will kill IIS Express.
Step 2: Tool | Options | Debugging | General | Uncheck 'Enable Edit and Continue'.
Step 3: Try it now.
精彩评论