Kestrelで証明書ストアの証明書を指定してHTTPSを構成

appsettings.jsonに書くだけで構成できた。

learn.microsoft.com

ちなみにASP.NET Core 2.1でも使えた。

{
  "Kestrel": {
    "Endpoints": {
      "Http": {
        "Url": "http://*:8080"
      },
      "Https": {
        "Url": "https://*:8081",
        "Certificate": {
          "Subject": "証明書のサブジェクト",
          "Store": "My",
          "Location": "CurrentUser",
          "AllowInvalid": false
        }
      }
    }
  }
}