c# - How can adding certificate to the trusted root certificates
问题描述
I am trying to make a web application, but when I browse my index page, I got this message:
This project is configured to use SSL. To void SSL warning in the browser you can choose to trust the self-signed certificate that IIS Express has generated.
Would you like to trust the IIS Express SSL certificate?
I pressed yes, after that I got this message:
Adding the certificate to the Trusted Root Certificates store failed with following error.
The access control list(ACL) structure is invalid.
After these messages my page shown in my browser but every time these messages shown at my face.
Note: I'm just learning by myself
解决方案
将您的 CA 证书导入您的资源
X509Certificate2 cert = new X509Certificate2(CertInstall.Properties.Resources.CA);
X509Store store = new X509Store(StoreName.AuthRoot, StoreLocation.LocalMachine);
store.Open(OpenFlags.ReadWrite);
store.Add(cert); //where cert is an X509Certificate object
store.Close();
推荐阅读
- java - 数组项未正确显示
- spring-boot - Spring Cloud Gateway 过滤器读取和修改响应体
- java - 从 java 转换时 kotlin 接收器出现问题
- c# - 为什么 HttpClient.PostAsync 似乎将请求作为 GET 而不是 POST 发送?
- vue.js - vue.js 的路由器页面无法显示双括号内容
- php - 使用 VBA 查看 HTTP 请求发送的数据
- sql-server - 从 Visual Studio 2012 执行时存储过程“旋转”
- asp.net - 如何在 azure 版本上指定目标路径?
- html - 将鼠标悬停在元素上时更改颜色
- c - 提取最小元素后的最小堆问题