In ,net core 2.1, I want to redirect from http to https.
services.AddHttpsRedirection(options =>
{
options.RedirectStatusCode = StatusCodes.Status301MovedPermanently;
options.HttpsPort = 5001;
});
However in localhost I don't use https, I just use http. Also I use a different port.
"MyProject": {
"commandName": "Project",
"launchBrowser": true,
"applicationUrl": "http://localhost:50642",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
It doesn't work in localhost unless I change the port to 5001 in launchSettings.json. How to make it working?