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();
    }
}

相关内容

热门资讯

于此同时!wepoker透视辅... 于此同时!wepoker透视辅助下载(透视)玖游卡五星辅助(竟然是真的辅助工具)-哔哩哔哩1、下载好...
透视妙招!约局吧开挂(透视)哈... 透视妙招!约局吧开挂(透视)哈糖大菠萝开挂(辅助)总是真的有攻略(哔哩哔哩)1、让任何用户在无需哈糖...
透视科技!we-poker正规... 透视科技!we-poker正规吗(透视)微信小程序微乐辅助器教程(总是存在有辅助插件)-哔哩哔哩1、...
透视步骤!德州来玩辅助器(透视... 透视步骤!德州来玩辅助器(透视)pokemmo手机版脚本(辅助)原来真的有app(哔哩哔哩)1、po...
透视ai代打!如何下载德普之星... 透视ai代打!如何下载德普之星辅助软件(透视)微信小程序万能修改器(原来是真的辅助插件)-哔哩哔哩微...
透视模块!德州局透视脚本免费版... 透视模块!德州局透视脚本免费版下载手机版(透视)uupoker透视(辅助)一贯真的是有脚本(哔哩哔哩...
目前!wepoker私人局辅助... 目前!wepoker私人局辅助挂(透视)天酷大厅辅助(切实有辅助工具)-哔哩哔哩天酷大厅辅助是不是有...
透视攻略!来玩app破解(透视... 透视攻略!来玩app破解(透视)约局吧怎么看有没有挂(辅助)切实真的有神器(哔哩哔哩)1、玩家可以在...
近期!微扑克微乐辅助(透视)兴... 近期!微扑克微乐辅助(透视)兴动互娱软件下载(一贯有辅助修改器)-哔哩哔哩1、兴动互娱软件下载模拟器...
透视烘培!pokemmo脚本辅... 透视烘培!pokemmo脚本辅助器下载(透视)pokemmo辅助器脚本下载(辅助)一直有技巧(哔哩哔...