I already have a window open with the web site I'm debugging. I don't need VS to launch another one for me every time I need to debug.
Is there a way to stop this behavior?
I already have a window open with the web site I'm debugging. I don't need VS to launch another one for me every time I need to debug.
Is there a way to stop this behavior?
Open your startup project's properties (Project → {ProjectName} Properties... from the main menu or right click your project in the Solution Explorer and choose Properties), then navigate to the Web tab and under Start Action choose Don't open a page. Wait for a request from an external application.
You will still be able to use any browser (or Fiddler, whatever) to access the running application, but it won't open the browser window automatically, it'll just start in the background and wait for any requests.
In an ASP.Net 5 project this can now be set for each launch profile.
Open the file launchsettings.json under the Startup Project Properties folder and add "launchBrowser": false
to the profile you are configuring, such as in:
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": false,
"environmentVariables": {
"Hosting:Environment": "Development"
}
}
}
When you first open a web/app project, do a Ctrl-F5, which is the shortcut for starting the application without debugging. Then when you subsequently hit F5 and launch the debugger, it will use that instance of IE. Then stop and start the debugging in Visual Studio instead of closing IE.
It works on my machines. I'm using the built in dev web server. Don't know if that makes a difference.
Firefox will also stay open so you can debug in either or both at the same time.
There seems to be one case in which none of the above but the following helps. I'm developing a project for Windows Azure cloud platform and I have a web role. There is indeed a radio button Don't open page in Project -> {Project name} properties... as was pointed out by Pawel Krakowiak, but it has no effect in my case whatsoever. However, there is the main cloud project in solution explorer and there is the Roles folder under it. If I right click my web role in this folder and choose Properties, I get another set of settings and on the Configuration tab there is the Launch browser for flag, after unchecking it a new browser window is not opened on application start up.
In Visual Studio 2019, I resolved the same issue as below:
Go to your Visual Studio options Tools >>> Options >>> Project and Solutions >>> Web Projects then finally untick option >>> Stop debugger browser window is closed, close browser when debugging stops
Step 1:
Step 2: untick option >>> Stop debugger browser window is closed, close browser when debugging stops
Step 3:
Then finally click on >>> OK button, these are all the steps to resolve the issue.
I looked over the answers and didn't see the solution I found mentioned. If it was, my apologies. In my case, currently using Visual Studio 2015. In the solution explorer, right click on the Project file and click properties. Go to the Debug tab and this should have info for how you're launching "IIS Express or Web(DNX)" for the first two drop downs, and then there should be a checkmark box for "Launch URL:". Uncheck this option and your browser won't be automatically launched everytime you go to debug your application. Hope this helps someone out.
While there are several excellent answers, ranging from usual suspects to newer solutions, I would like to provide one more to the fray that addresses what you should do when you are working on a solution with multiple projects.
Before I arrived at this solution, I kept looking at bindingInformation
in the applicationhost.config of the solution, tirelessly looking for any hint of why things were simply not working.
Turns out, the simple thing that I overlooked was that different projects have individual settings too.
So, besides
Project > {Project-Name} Properties... > Web > Start Action
on my Backend Project, I also had to Go toWebsite > Start Options... > Start Action
on my Frontend Project. Once there, I selectedDon't open a page. Wait for a request from an external application
and have been happy ever since!
If you're using the Web Publish feature in IIS, then the solution I found was to edit the publish configuration and remove the Destination URL
from the configuration (leave it blank).
If this is defined, then every time you publish the project it will open the URL specified in the Destination URL
(which is a redirect URL).
Reference: https://support.winhost.com/kb/a1604/visual-studio-publish-web-deploy.aspx
You can now also get to the Web properties by clicking the dropdown arrow next to the Run button!
You're all set!
PS: This works for me, I'm on version 16.5.5 of VS Professional 2019 :)