Jiro Laboratory

C#、ASP.NET、JavaScript、Androidとか

ASP.NET MVC Core 「HTTPS 用の構成」の有無による生成ソースの違い

HTTPS 用の構成」の選択有無による生成ソースの違いを調べました。
違いがあったのは
・launchSettings.json
・Startup.cs
のみです。

gist.github.com

launchSettings.json

HTTPS 用の構成」なし

"applicationUrl": "http://localhost:5000",

HTTPS 用の構成」あり

"applicationUrl": "https://localhost:5001;http://localhost:5000",
Startup.cs

HTTPS 用の構成」ありの場合、app.UseHsts()、app.UseHttpsRedirection() が追加されます。

HTTPS 用の構成」なし

else
{
    app.UseExceptionHandler("/Home/Error");
}

app.UseStaticFiles();
app.UseCookiePolicy();

app.UseMvc(routes =>

HTTPS 用の構成」あり

else
{
    app.UseExceptionHandler("/Home/Error");
    app.UseHsts();
}

app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseCookiePolicy();

app.UseMvc(routes =>