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

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

Related

Configure Visual Studio or Chrome To Launch Multiple Asp.Net Projects In The Same New Browser Window

I have a solution in Visual Studio 2017 with multiple Asp.Net startup projects.
Current Behavior
When I start debugging each project starts in a new Chrome window with a single tab.
Desired behavior
When I start debugging all web pages start in the same new Chrome window, each in its own tab.
I had the desired behavior in Brave browser, apparently by default—but for business reasons I now need to switch to debugging primarily in Chrome.
So, I suspect this is a browser setting, but as long as I get the desired behavior I am willing to adjust settings in either the browser, Visual Studio or both.
UPDATE:
To be clear this is not:
How to use the same browser window every time you start a project in Visual Studio?
Nor is it:
Stop Visual Studio from launching a new browser window when starting debug?
I do want a new browser window, apart from any previous debugging and indeed a separate instance from any browser I may have already started on the same machine.
To Launch Multiple Asp.Net Projects In The Same Browser Window
You can go Tools menu => Options => Project and Solutions => Web Projects, then you can find a setting called:
Stop debugger when browser window is closed, close browser when debugging stops
Uncheck it and click OK, then you can start the multiple projects in same Browser Window. Note: This behavior after uncheck that setting may not meet all your needs.It will not open in new Chrome instance but in a already running Chrome instance if it exists.
When set the Chrome as default browser in VS. If you've already have a Chrome browser running, start the solution and it will open several tabs in that existing Chrome instance. And only when you have no Chrome instance running, it will start same new Chrome browser window as you expected. So actually this setting only meet part of your expected behavior I guess.
To Launch Multiple Asp.Net Projects In The Same New Browser Window
It seems only when you have no Chrome instance running, this behavior can be reached. And as far as I know, there's no setting in VS can configure VS to always launch Chrome in a new instance with several tabs when start the solution with multiple startup projects.So maybe you can go Developer Community to share your requirement to the Product Team by Suggest a Feature option. Hope it makes some help:)
To avoid using an open browser you can use Browse with... if you can give any argument to chrome however arbitrary, it will open a new browser window. It provides the chrome instance a new "signature" and VS will see the browsers as separate applications.

Visual Studio 2017 Launches Two Instances Of IE When Debugging A Single Project

My development machine was recently renamed and updated to Windows 10. While debugging a single ASP.Net project in VS 2017, I press F5 and two instances of the same page show up in my IE-11 Browser (Two Tabs - Same Page) which screws up the debugger. It works fine when I launch under chrome but I need to debug IE for now since it is still the company standard.
Has any seen this behavior and is there a way to fix it?
Thanks for any insight - it's driving me crazy.
After a lot of head scratching, I finally came up with the solution and it was one of those things where it was simple. After the Windows 10 upgrade occurred, the software went and reset all of my IE 11 browser settings. There is an option on the first option page that says "Start with tabs from last session". This was selected and every time a new VS browser window fired up it went and created a tab from my previous session. I selected the other option "Start with home page" and the problem went away.

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.

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

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.

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