I am trying to enable secure communication for my ASP.NET Core Web API project. I did this by checking "Use SSL" checkbox after right-clicking the project and clicking on the properties tab.
This is my launchsettings.json
file
{
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "http://localhost:31200/health",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"ISRMServices.Auth": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:31205/"
}
},
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:31200/",
"sslPort": 44399
}
}
}
Now when I am trying to run my application using IIS Express, on the browser address bar, I see 2 URL's:
https://localhost:44399/https://localhost:31200/health
Instead I would like it to be only https://localhost:44399
or https://localhost:44399/swagger
.
How do I achieve this ?
After testing, if you would like it to be likehttps://localhost:44399
you can change the launchUrl configuration to "launchUrl": ""
,and you can refer to the following example:
{
"$schema": http://json.schemastore.org/launchsettings.json,
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": http://localhost:47808,
"sslPort": 44313
}
},
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": http://localhost:5084,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": https://localhost:7293;http://localhost:5084,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
If you want the url to render https://localhost:44399/swagger
, you can set launchUrl to "launchUrl": "swagger"
: