<p>I have VS2005 and I am currently trying to debug an ASP.net web application. I want to change some code around in the code behind file, but every time I stop at a break point and try to edit something I get the following error message: "Changes are not allowed when the debugger has been attached to an already running process or the code being debugged is optimized."</p>

<p>I'm pretty sure I have all the "Edit and Continue" options enabled. Any suggestions?</p>

[{'answer_id': 76372, 'author': 'user13276', 'author_id': 13276, 'author_profile': 'https://Stackoverflow.com/users/13276', 'pm_score': 4, 'selected': True, 'text': "<p>The application is actually running off of a compiled version of your code.  If you modify it it will have to recompile it in order for your changes to work, which means that it will need to swap out the running version for the new compiled version.  This is a pretty hard problem - which is why I think Microsoft has made it impossible to do.  It's more to protect you from THINKING some changes were made when they really weren't.</p>\n"}, {'answer_id': 76414, 'author': 'Jarrett Meyer', 'author_id': 5834, 'author_profile': 'https://Stackoverflow.com/users/5834', 'pm_score': 1, 'selected': False, 'text': '<p>You are allowed to make changes to the <code>*.aspx</code> file while it runs, and you can hit refresh on your web instance to see those changes immediately. However, you cannot make changes to the <code>*.cs/*.vb</code> or <code>*.designer.cs/*.designer.vb</code> files while the program runs.</p>\n'}, {'answer_id': 76791, 'author': 'Chris Bilson', 'author_id': 12934, 'author_profile': 'https://Stackoverflow.com/users/12934', 'pm_score': 4, 'selected': False, 'text': '<p>This may seem counter-intuitive, but turn edit and continue off. </p>\n\n<p>There might be another "allow me to edit read-only files" or "allow me to edit even when I am debugging...no really!" setting somewhere, but I don\'t have 2005 to look at to check. </p>\n\n<p>In 2008, turn off edit and continue and you can edit while it\'s running (but those changes aren\'t appplied.)</p>\n\n<p>If you actually want to use edit and continue, you also have to enable it for the project, on the web tab of the project settings.</p>\n'}, {'answer_id': 255059, 'author': 'Steve Steiner', 'author_id': 3892, 'author_profile': 'https://Stackoverflow.com/users/3892', 'pm_score': 2, 'selected': False, 'text': "<p>For Asp.net it is possible to think of two types of 'edit and continue'.  </p>\n\n<p>One is a classic edit and refresh the browser.  This works because the browser refresh recompiles everything except precompiled code behind files.  This is not referred to as Edit and Continue, though in practice it provides a similar effect.  In this mode you cannot change code behind files, because they were precompiled and deployed, but you can change just about anything else.</p>\n\n<p>Another mode allows you to change precompiled code behind files but nothing else ... (this is the mode Chris Bilson mentions which needs to be set on the project properties for ASP.Net).  In this case you are using the Edit and Continue feature of the debugger, which knows preciously little about ASP.net.  The debugger just sees a loaded .Net assembly and can modify it when stopped in the debugger because there is a project in the solution that claims to know how to build it.  In this case you are prevented from modifying things that would otherwise mess up the debugging session.  This method however is the only way to change the code while it is running rather than requiring a browser refresh.</p>\n"}, {'answer_id': 2826088, 'author': 'abc', 'author_id': 340180, 'author_profile': 'https://Stackoverflow.com/users/340180', 'pm_score': -1, 'selected': False, 'text': '<p>Check that you are not in release mode.\nIn release mode you cannot edit your code while debugging. Just change mode to Debug</p>\n'}, {'answer_id': 3018600, 'author': 'Rob', 'author_id': 363987, 'author_profile': 'https://Stackoverflow.com/users/363987', 'pm_score': 1, 'selected': False, 'text': '<p>I search for this on Visual Studio 2008 WAP (Web Application Project) and it took me two days to find the solution, so here it is in the hopes it helps somebody else:</p>\n\n<p>There are two locations that have to be checked, one it under tools-options-debugging-Edit And Continue-Enable Edit And Continue, the other is right click project-properties-Web-Enable Edit And Continue</p>\n'}, {'answer_id': 3856333, 'author': 'user279521', 'author_id': 279521, 'author_profile': 'https://Stackoverflow.com/users/279521', 'pm_score': 0, 'selected': False, 'text': '<p>For the record, I had a similar problem with VS 2008 and a different solution resolved the problem for me.  <a href="https://stackoverflow.com/questions/2781060/editing-code-in-visual-studio-2008-in-debug-mode">Editing code in Visual Studio 2008 in debug mode</a></p>\n'}]
['https://Stackoverflow.com/questions/76349', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/13556/']