Reputation: 1772
I am using VS 2022 and ASP.NET Core 6 MVC.
When I debug my app, it is starting with https://localhost:7043/
, but I want it to start with https://localhost:7043/calculate
.
How to force my app to start from that URL? I don't see a startup.cs
anywhere.
I am learning ASP.NET Core MVC and I don't have much code to share.
Added this my launchsettings.json
according to one of answer here still no effect:
Upvotes: 0
Views: 1191
Reputation: 459
As of .NET 7 the following code at the end of your Program.cs file works so your app is listening there if that's what you're asking
app.Run("http://localhost:5001");
Upvotes: 0
Reputation: 3505
you can set applicationUrl
in launchSettings.json
"iisExpress": {
"applicationUrl": "https://localhost:7043/calculate",
....
You can also define urls in the program.cs file:
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
webBuilder.UseUrls("https://localhost:7043/calculate");
});
this link Set start URL in ASP.NET Core has useful information...
Upvotes: 2