(如果重要的话,可以在 Mac 上运行。)
在 Visual Studio 中,您可以在运行或调试 ASP.NET Core 项目时使用此方法启动特定 URL。使用 launchUrl 属性。这是一个示例 launchSettings.json 文件:
{
"profiles": {
"MyProjectName": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "customstartupurlgoeshere/?id=theanswertotheuniverse",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:5001;http://localhost:5000"
}
}
}
VS Code 中的模拟是什么?我读到 VS Code 会忽略 launchSettings.json 文件。
您可以更新您的launch.json
。添加serverReadyAction
's uriFormat
; e.g.,
"serverReadyAction": {
"action": "openExternally",
"pattern": "\\bNow listening on:\\s+https://localhost:([0-9]+)",
"uriFormat": "https://localhost:%s/swagger"
},
请注意,在示例中,我们专门捕获端口号,因为该端口号用于第一个%s
在里面uriFormat
.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)