首页 > 解决方案 > 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

标签: c#asp.net-mvc-5visual-studio-2019

解决方案


将您的 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();

推荐阅读