Lot of people trying to edit the code when ASP.NET Development Server is running but they can’t. In order to edit code you have to stop debugger/ ASP.NET Development server then you can edit it.
If you want to continue code edit while your are running ASP.NET Development Server try this:

You do have the option to control which port is used when using the built-in development server. The steps to specify the port to be used are slightly different depending on whether you are using a website project or a web application project.
ASP.NET Development Server - Web Application project
  1. Right click the Project in the Solution Explorer, and then select “Properties”
  2. Click “Web” tab.
  3. Go to Server section (Make sure Visual Studio Development server is selected)
  4. Check Enable Edit and Continue is turned on