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

相关内容

热门资讯

透视机巧!hhpoker作必弊... 透视机巧!hhpoker作必弊码(AApoker透视)一贯是真的有辅助脚本(哔哩哔哩)该软件可以轻松...
此事备受玩家关注!微乐小程序黑... 此事备受玩家关注!微乐小程序黑科技免费,微信小程序微乐辅助器ios(透视)一贯存在有辅助教程(哔哩哔...
透视窍门!德州局脚本(德普之星... 透视窍门!德州局脚本(德普之星辅助软件)本来有辅助app(哔哩哔哩)1、德普之星辅助软件破解器简单,...
黑科技插件!微乐小程序免费黑科... 黑科技插件!微乐小程序免费黑科技,微信小程序微乐辅助器脚本(透视)总是是有辅助插件(哔哩哔哩)所有人...
透视绝活儿!wpk俱乐部有没有... 透视绝活儿!wpk俱乐部有没有辅助(WePoKer软件)真是有辅助工具(哔哩哔哩)1、wpk俱乐部有...
透视好友房!微乐小程序黑科技,... 透视好友房!微乐小程序黑科技,微乐智能插件激活码(透视)本来是真的辅助技巧(哔哩哔哩)暗藏猫腻,小编...
透视方针!hhpoker脚本(... 透视方针!hhpoker脚本(WePoKer脚本)真是真的是有辅助方法(哔哩哔哩)该软件可以轻松地帮...
辅助透视!微乐小程序黑科技免费... 辅助透视!微乐小程序黑科技免费,微信微乐自建房脚本免费下载(透视)其实是真的辅助app(哔哩哔哩)所...
透视法子!wepoker有没有... 透视法子!wepoker有没有辅助(HHpoker透视挂)竟然真的是有辅助工具(哔哩哔哩)1)wep...
透视模拟器!微信微乐游戏辅助脚... 透视模拟器!微信微乐游戏辅助脚本,微乐自建房辅助入口官网(透视)好像是真的辅助器(哔哩哔哩)1、下载...