2
使用ASP.NET MVC的核心,我需要設置我的開發環境中使用HTTPS,所以我增加了下面的Main
方法的Program.cs:Access環境名ASP.NET核心
var host = new WebHostBuilder()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.UseKestrel(cfg => cfg.UseHttps("ssl-dev.pfx", "Password"))
.UseUrls("https://localhost:5000")
.UseApplicationInsights()
.Build();
host.Run();
如何在此處訪問宿主環境,以便可以有條件地設置協議/端口號/證書?
理想情況下,我只想用CLI來操縱我的託管環境,像這樣:
dotnet run --server.urls https://localhost:5000 --cert ssl-dev.pfx password
,但似乎並沒有被這樣使用命令行的證書。
我忘了大約統環境。謝謝! –