[英]launchSettings.json file opens wrong URL
When I try I couldn't run this project in my computer today but my teammates can run at their own computer.当我尝试时,我今天无法在我的计算机上运行这个项目,但我的队友可以在他们自己的计算机上运行。 By the way I can run other projects.
顺便说一句,我可以运行其他项目。 My launchSettings file like this:
我的launchSettings文件是这样的:
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:4321",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
//"launchUrl": "User",
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Dashboard.WebAPI": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "User",
"applicationUrl": "http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
But when I run this project my url is opening as "https://localhost:4321/swagger/index.html".但是当我运行这个项目时,我的网址打开为“https://localhost:4321/swagger/index.html”。 I guess this problem is because this url is run as "https" but my applicationUrl is "http".
我猜这个问题是因为这个 url 作为“https”运行,但我的 applicationUrl 是“http”。
What could be the cause of this problem?这个问题的原因可能是什么?
Edit: My browser:编辑:我的浏览器:
Either disable Https redirection in your Startup.cs/Program.cs depending whether you use .net5 or .net6 or put your sslPort value in launchSettings.json to a 4322 port (or some other of your choosing, just not any that are in use) and it'll work.要么在 Startup.cs/Program.cs 中禁用 Https 重定向,具体取决于您使用的是 .net5 还是 .net6,或者将您在 launchSettings.json 中的 sslPort 值设置为 4322 端口(或您选择的其他端口,而不是任何正在使用的端口) ),它会工作。
Edit:编辑:
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:4321","https://localhost:4322",
"sslPort": 4322
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
//"launchUrl": "User",
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Dashboard.WebAPI": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "User",
"applicationUrl": "http://localhost:5000","https://localhost:5001"
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
On the Visual Studio toolbar their is a dropdown that allows you to select which profile to run.在 Visual Studio 工具栏上,它们是一个下拉菜单,允许您选择要运行的配置文件。 I suspect you are running the IIS Express profile when you want to run the Dashboard.WebAPI profile.
当您想运行 Dashboard.WebAPI 配置文件时,我怀疑您正在运行 IIS Express 配置文件。 If you see "IIS Express" on your toolbar with a green arrow to the left of it then select the dropdown and choose Dashboard.WebAPI (see mocked up image below)
如果您在工具栏上看到“IIS Express”,其左侧有一个绿色箭头,则选择下拉菜单并选择 Dashboard.WebAPI(请参见下面的模拟图像)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.