我已经打开了一个窗口与我正在调试的网站。我不需要VS为我启动另一个每当我需要调试。

有没有办法阻止这种行为?


当前回答

在ASP中。Net 5项目现在可以为每个启动配置文件设置。

打开文件launchsettings。在Startup Project Properties文件夹下添加"launchBrowser": false到你正在配置的配置文件中,例如:

"profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": false,
      "environmentVariables": {
        "Hosting:Environment": "Development"
      }
    }
}

其他回答

对于VS2022和ASP。NET核心:

另一个快捷方式是:单击右边绿色三角形按钮上的小下拉按钮,上面有项目名称,这通常会启动调试版本。然后是最后一个选项“{项目名}调试属性”,它直接启动专用的UI窗口。

从那里遵循@irf的建议:

“uncheck”选项不自动打开。

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.

您现在还可以通过单击Run按钮旁边的下拉箭头来访问Web属性!

点击“运行”旁边的下拉按钮 {项目名称}属性 点击左侧列表中的“Web” 在“开始操作”段下,单击“不打开页面”。

你都准备好了!

PS:这对我来说是有效的,我使用的是VS Professional 2019的16.5.5版本:)

在Visual Studio 2019中,我解决了同样的问题:

去你的Visual Studio选项工具>>>选项>>>项目和解决方案>>> Web项目然后最后取消选项>>>停止调试器浏览器窗口关闭,关闭浏览器时调试停止

步骤1:

步骤2: >>>关闭调试器浏览器窗口,调试停止时关闭浏览器

步骤3:

最后点击>>> OK按钮,这些都是解决问题的步骤。

以下是对我有用的方法:

去项目属性>调试>取消“启动浏览器”>保存。