.NET5 本地境配置https 无需搭建SSL环境


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.双击安装证书到信任位置

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM