The asp.net code still executes after clicking stopping debugging in VS2008 - asp.net

I create a asp.net page and test the code in debug mode step by step.
I always think that the code will stop running after I click "stopping debugging" in VS2008 when I test it in IE because the IE closes immediately.
Today, I use Firefox to test it. I find that the code still executes continuously after I click "stop debugging".
I want the code stop running immediately even in FF.
What should I do?

this happens in vs2010 also.
solution is to goto: Debug menu and choose Terminate All

Stop the web server from the task bar, assuming you are using Cassini. It will stop the debugger and the web site itself.

I imagine you are, with IE, just 'running' the project, and IE opens immediately? And with Firefox, you open firefox manually, and navigate to the appropriate site?
The difference is that with running it, Visual Studio will close the browser when you stop debugging. In Firefox, because Visual Studio didn't open the browser, it won't close it.
Does that make sense?
Either way, the code still "exists" in both cases, and only runs when it's executed.

Related

Chrome won't load pages after Stop Debugging in Visual Studio

If I F5 to debug, and browse to my test site using Chrome, and execution halts before sending a response (e.g. we get an exception and I click Stop Debugging instead of continue to the end), that Chrome window and any child windows it spawns will no longer work with the project. It will say "Loading" with the spinner in the tab, the window will be empty, and it will stay like this apparently forever. Alternately, in a new tab, I type the URL and hit enter and it does not display any loading behaviour as though it isn't even trying to load it. This persists across tabs within the same window hierarchy.
My workaround is to create incognito windows in Chrome when testing local sites. If it gets into this error state, then I have to close the window and open a new incognito session from the original browser parent. If I accidentally cause this problem in the main window, I have to fully close Chrome to proceed. Using different Chrome profiles also works as I assume it's a different top level process.
Otherwise, it does seem to calm itself after quite a while - 5+ real life minutes or something similar it will revert and start working again and the page will load if it was still trying. But is there a better solution? This is VS 2022, debugging ASPX/C#, using a hosts file for local.site.com domains and separate http/https ports.
Edit: Image to show settings page
Your issue is rare, we need to troubleshoot step by step. First, please confirm that Tools==>Options==>Debugging==>General==>Enable Edit and Continue is enabled. Then you need to use detach all instead of stop debugging.
Well, if you hit a break-point in code behind, then code has haulted, and no more web pages can be dished out. (this is standard behavour when using the built-in web server that launches by hitting F5. if you close the web page, then the web server shuts down, debugging stop, and you back into Visual Studio.
You could try hitting ctrl-F5. That runs the VS site as non debug mode, and break-points etc. thus don't usually get hit. But, f5 STARTS a copy of IIS express web server. You close that web page, then debugging stop, IIS is then shut down. This is correct behavior's.
If you want to start testing the web site with say NOT having a debugger tied to the web site, then you probably are better off to install + run IIS full edition, and not the Express Edition that is "tied" to VS and the debugger.
So, the instant you close the browsesr, or even hit the "stop" button in VS, then IIS is shut down - it is stopped each time.
However, you could/can give ctrl-F5 a try - that will launch your site as non debug mode (and you not that no stop button is highlight).
IIS "express" is a great setup for f5, step code, debug code. However, the instant you want to start testing the site, and not having launched it from "inside" of VS? Then you probably should setup a VM with the full edition of IIS, or even I suppose install full edition of IIS on your computer (I not done that, since I have a few VM's, and I don't want to "mess up" my developer box with having a full pop full edition of IIS installed on my computer.
So, if you want "others" to test the site, then setup a VM with server 2019, or whatever, and then install IIS full edition. This THEN gives you the full GUI and setup features of a web server - which is a good learning experience.
So when using f5 to debug? yes, a halt in code will halt the ability of the web server to dish out other pages. In effect, IIS process one page at a time, and when the page life cycle is done, the the next page/request can be processed.
So, if you want "more" then this setup, then you probably need/want to get a full blown full edition of IIS up and running. And I suggest that should be placed on some other computer then your dev box, or at the very least in a VM on your dev box.
You "can" sort of get IIS Express edition to be launched and running outside of a VS debug session, but it is painfully, since you don't have the GUI and all of the web configuration tools that the full edition of IIS has.

Visual Studio 2017 release 15.7.3 does not launch application successfully

I have a fairly standard web application with a single HELLO WORLD aspx test page, so for the purposes of this question, that is the start page.
When I run the app from visual studio by pressing f5 I get "Cannot reach this page" or whatever the 404 equivalent is in each browser. (chrome: "this site can't be reached"). In firefox, the page runs successfully first time, firefox doesn't have any debugger attachment add ins, so the problem seems to relate to debugger attachment in IIS express
If I wait a few seconds, and then F5 the browser (IE or chrome), the expected page loads successfully, so it seems to be a delay in IIS starting when a debugger is attached.
I'm wondering if anyone else has hit this and whether they have a solution. We have a quite a few tweaks in web.config to meet high security needs but otherwise I can't think why it would go wrong.
Workaround is to wait a few seconds and press f5, but thats kind of annoying when you're trying to get on with things.
As described by O.H., and verified by user2728841, the solution for me was:
Tools > Options > Debugging and changing "Enable JavaScript debugging for ASP.NET".
However, opposite to O.H. and like user2728841, my option was deselected, and selecting it solved the problem.

Debugging with Chrome shows "Restore pages?" pop-up every time

If I press the stop debugging button while debugging my ASP.NET Core app in Google Chrome it closes the Kestrel process window and the Chrome window that opens automatically on launching Debug. This is great and convenient!
Unfortunately it seems like Visual Studio closing Chrome in this way confuses Chrome and makes it think it has crashed. So every time I launch debugging in Visual Studio, a new Chrome window opens, and I see this annoying pop-up:
I found a similar issue brought up here, but it is for VS Code instead of VS2017. I don't think launch.json is a concept in VS2017 so I have no idea how to implement that workaround.
How can I prevent this from happening? Thanks!
Close all open Chrome windows
Edit file:
"%UserProfile%\AppData\Local\Google\Chrome\User Data\Default\Preferences"
Set:
"exit_type": "none"
and
"exited_cleanly":true
Change the Preferences file to readonly

Visual Studio 2008 SP1 - How to stop debugging in other browsers than IE?

Visual Studio has integrated debugging in IE, when you close IE, it stops debugging, and if you stop debugging, VS closes IE.
I want it to do the same thing with firefox/chrome! (mainly this 2, if is it possible with others, it'll be appreciated!)
Is there a way to do this?
Thanks in advance!
You need to change Visual Studio's default browser to Firefox/Chrome. To change this setting, right-click on an aspx file in Solution Explorer and select Browse With. Select the desired browser and set it as default.
What you need is to write a macro that opens up ff (or any other browser) with the debugging url.
Then you can control it and close it when the debugging ends.
but i think this task is quite hard to implement.
who mentioned here to simply set the default debug browser is not answering your question at all, b/c it will not be closed...
With Firefox established as your default browser and Firebug installed, you can debug your script in Firefox. Select Tools > Firebug > Open Firebug. The Firefox instance now shows the debugging console. To enable script debugging, click the Console tab, check the Script option, and click the "Apply settings for localhost" option.

Visual Studio - Prevent stopping debugging from closing Internet Explorer

Under visual studio if you run a web project by pressing the Go button on the Debugging toolbar, then stop it by pressing the Stop button on the debugging toolbar, Internet Explorer is opened and closed by the IDE.
Is there a way to prevent the IDE from closing Internet Explorer when stopping debugging? I want to do this to allow myself to refer to the content of the pages in IE while editing my code.
I find that running it once without debugging is the way to go. First time, hit CTRL + F5 (starts web without debugging). This opens your browser and starts the web server for you.
Later on, you could debug and it'll use your same browser window, but hitting stop won't cause the window to close.
Use the Detach All option from the Debug menu.
This is the way I do it:
Get the URL for your project, you may have to run it once to get the port number and to start up the webserver (if you are using the built in one).
Then open a browser session, and put your URL in.
IF you want/need to debug, then just do an attach to process under the debug menu, I have setup a shortcut/macro to do this step for me.

Resources