C# 运行应用程序时,在VSCode中的ASP.NET核心应用程序中启动特定URL
(在Mac电脑上运行,如果有必要的话。) 在Visual Studio中,在运行或调试ASP.NET核心项目时,可以使用此方法启动特定URL。使用launchUrl属性。这是一个示例launchSettings.json文件:C# 运行应用程序时,在VSCode中的ASP.NET核心应用程序中启动特定URL,c#,asp.net-core,visual-studio-code,vscode-settings,C#,Asp.net Core,Visual Studio Code,Vscode Settings,(在Mac电脑上运行,如果有必要的话。) 在Visual Studio中,在运行或调试ASP.NET核心项目时,可以使用此方法启动特定URL。使用launchUrl属性。这是一个示例launchSettings.json文件: { "profiles": { "MyProjectName": { "commandName": "Project", "launchBrowser": true, "launchUrl": "customstartupu
{
"profiles": {
"MyProjectName": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "customstartupurlgoeshere/?id=theanswertotheuniverse",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:5001;http://localhost:5000"
}
}
}
VS代码中的模拟是什么?我读到VS代码忽略launchSettings.json文件 VSCode在启动程序时采用
.VSCode/launch.json
配置
已使用launchUrl属性。。。。VS代码中的模拟是什么
您可以更改args
参数以接受--url
的参数。例如,如果您想让红隼在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"
}
},
“配置”:[
{
“名称”:“.NET核心发布(web)”,
“类型”:“coreclr”,
“请求”:“启动”,
“预启动任务”:“构建”,
“程序”:“${workspaceFolder}/bin/Debug/netcoreapp3.0/App.dll”,
“参数”:[“--URL”https://localhost:6001;http://localhost:6000"],
“cwd”:“${workspaceFolder}”,
“stopAtEntry”:false,
“serverReadyAction”:{
“行动”:“对外开放”,
“模式”:“^\\s*正在收听:\\s+(https?:/\\s+”
},
“环境”:{
“ASPNETCORE_环境”:“开发”
},
“sourceFileMap”:{
“/Views”:“${workspaceFolder}/Views”
}
},