AppService监听器中的数字证书CN名称和主机名
创始人
2024-11-10 08:00:22
0

使用以下代码示例来指定数字证书的CN名称和主机名。将示例中的“cn_name”和“hostname”替换为实际的CN名称和主机名。

using System.Security.Authentication;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Server.Kestrel.Https;

public class Program
{
    public static void Main(string[] args)
    {
        var host = new WebHostBuilder()
            .UseKestrel(options =>
            {
                options.Listen("localhost", 5000, listenOptions =>
                {
                    listenOptions.UseHttps(new HttpsConnectionAdapterOptions
                    {
                        ServerCertificate = CertificateHelper.LoadFromStoreCert("cn_name", "My", StoreLocation.CurrentUser, allowInvalid: true),
                        ClientCertificateMode = ClientCertificateMode.RequireCertificate,
                        ClientCertificateValidation = CertificateHelper.ValidateClientCertificate,
                        SslProtocols = SslProtocols.Tls12,
                        CheckCertificateRevocation = true,
                        ClientCertificateCollection = CertificateHelper.LoadFromStoreCerts("My", StoreLocation.CurrentUser)
                    });
                });
            })
            .UseStartup()
            .Build();

        host.Run();
    }
}

相关内容

热门资讯

透视揭幕"hhpok... 透视揭幕"hhpoker一直输有挂吗"果然真的是有辅助技巧(哔哩哔哩);1、用户打开应用后不用登录就...
透视计算"wepok... 透视计算"wepoker有辅助器吗"aapoker透视方法(总是存在有辅助修改器)-哔哩哔哩1、we...
透视透视"wepok... 透视透视"wepoker分析"总是真的是有辅助插件(哔哩哔哩)1、游戏颠覆性的策略玩法,独创攻略技巧...
据报道"wepoke... 据报道"wepoker线上大神"hhpoker为什么一直输(真是是真的辅助下载)-哔哩哔哩1、hhp...
透视教你"wepok... 透视教你"wepoker透视脚本是什么"果然有辅助技巧(哔哩哔哩)wepoker透视脚本是什么脚本下...
据统计"hhpoke... 据统计"hhpoker有透视功能吗"cloudpoker外开挂(果然存在有辅助app)-哔哩哔哩1、...
透视美元局"wpk安... 透视美元局"wpk安卓下载辅助"hhpoker一直输有挂吗(都是真的有辅助工具)-哔哩哔哩1、全新机...
透视总结"werpl... 透视总结"werplan外开挂"本来真的是有辅助教程(哔哩哔哩)1、werplan外开挂免费脚本咨询...
围绕透视问题"红龙p... 围绕透视问题"红龙poker辅助"购买的wpk辅助在哪里下载(都是是真的辅助平台)-哔哩哔哩1、进入...
透视关于"wepok... 透视关于"wepoker有没有透视方法"都是真的是有辅助教程(哔哩哔哩)1、金币登录送、破产送、升级...