UPDATE:
I forgot to add the default controller route/endpoint in config. Adding the following code to Program.cs solves the problem but I do get a warning message that says "Suggest using top level route registrations instead of UseEndpoints.
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
});
ORIGINAL ISSUE:
I've created a new ASP.NET Core 8.0 MVC web app and populated it with controllers, views, models, classes, etc from an older Core 3.1 project.
The project compiles ok but I cannot debug using IIS Express. I remember having the same problems when first using VS 2019. However, I did manage to get it working. I'm now on VS 2022 and when I try to run/debug the project with IIS Express I get the following error in Chrome:
This localhost page can't be found. No webpage was found for the web address: https://localhost:44389/
I've tried changing various port numbers but I end with with further errors about not being able to register the port number.
If I create a new blank/default ASP.NET Core 8 MVC test app in VS2022 it runs/debugs in IIS Express fine without issue.
Project Settings -> Debug -> Launch profiles
IIS Express App URL: http://localhost:58088
App SSL URL: https://localhost:44389 (grayed out cannot be changed)
Use SSL: Checked
launchSettings.json
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:1191",
"sslPort": 44389
}
},
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:5099",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:7247;http://localhost:5099",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
