1.修改用Kestrel
.ConfigureWebHostDefaults(webBuilder => { webBuilder.UseUrls("http://*:5000", "https://*:5001").UseStartup<Startup>(); webBuilder.UseKestrel(option => { option.ConfigureHttpsDefaults(o => { o.ServerCertificate = new System.Security.Cryptography.X509Certificates.X509Certificate2(@"E:\charger\ssl\Certificate.pfx", "F3ibzYy2"); //证书路径、密码 }); }); })
2.用工具CreateCertGU生成crt证书
下载地址 https://download.csdn.net/download/jine515073/18972476
3.转换成pfx 地址:https://www.ssldun.com/tools/ssl-converter.php
4.双击安装证书到信任位置