[ASP.NET] Changing the ASP.Net core 6 Kestrel default hosting address and port
발행일: Feb, 2025
조회수: 0
단어수: 64
Table of Contents
Method 1: Configure in appsettings.json
Add the following configuration to your appsettings.json file to define Kestrel endpoints:
{
"Kestrel": {
"Endpoints": {
"Http": {
"Url": "http://localhost:5000"
},
"Https": {
"Url": "https://localhost:5001"
}
}
}
}
Method 2: Define in Program.cs
You can also specify the endpoint directly in Program.cs:
await app.RunAsync("http://localhost:5000");
Further Reading
For more details, refer to the official Microsoft documentation:
Configure Endpoints in ASP.NET Core Kestrel Web Server