Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
753 views
in Technique[技术] by (71.8m points)

asp.net core - What the difference between "Urls" and "Endpoints" in Kestrel settings?

In ASP Net core web application, you can set which URL the application will listen in two different ways inside the appsettings.json:

1)

{
  "Kestrel": {
    "Endpoints": {
      "Http": {
        "Url": "http://localhost:9999"
      }
    }
  }
}
{
  "Urls": "http://localhost:9999"  
}

What are the differences between both approaches and why they exist?

question from:https://stackoverflow.com/questions/65891745/what-the-difference-between-urls-and-endpoints-in-kestrel-settings

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

As far as I know, both “Urls” and “Endpoints” is used to configure endpoints for the ASP.NET Core Kestrel web server.

The urls host configuration key have the limitations.(a default certificate must be available for HTTPS endpoint configuration).

But if you use the Endpoints points, you could have multiple endpoints settings with each own certificate.

Besides, the Url parameter in Endpoints is required for each endpoint. These endpoints replace those defined in the top-level Urls configuration rather than adding to them. Endpoints defined in code via Listen are cumulative with the endpoints defined in the configuration section.

More details, you could refer to this article.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...