(如果重要,请在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文件。
答案 0 :(得分:0)
VSCode在启动程序时采用.vscode/launch.json
配置。
使用了launchUrl属性.... VS Code中的模拟是什么?
您可以更改args
参数以接受--urls
的参数。例如,如果您想让茶est听6001
/ 6000
:
"configurations": [ { "name": ".NET Core Launch (web)", "type": "coreclr", "request": "launch", "preLaunchTask": "build", "program": "${workspaceFolder}/bin/Debug/netcoreapp3.0/App.dll", "args": ["--urls","https://localhost:6001;http://localhost:6000"], "cwd": "${workspaceFolder}", "stopAtEntry": false, "serverReadyAction": { "action": "openExternally", "pattern": "^\\s*Now listening on:\\s+(https?://\\S+)" }, "env": { "ASPNETCORE_ENVIRONMENT": "Development" }, "sourceFileMap": { "/Views": "${workspaceFolder}/Views" } },