簡體   English   中英

如何在IIS下填充系統證書?

[英]How to populate system certificates under IIS?

我需要填充系統證書。 相同的源代碼告訴我,在VS下調試證書時,證書可以正確計數。 在IIS 7.5 Windows 7下運行代碼時,.Count始終返回0。是否存在任何權限問題? 為什么計數返回0?

        System.Security.Cryptography.X509Certificates.X509Store store = new System.Security.Cryptography.X509Certificates.X509Store(System.Security.Cryptography.X509Certificates.StoreName.My);
        store.Open(System.Security.Cryptography.X509Certificates.OpenFlags.ReadOnly);
        Response.Write("<hr>Certs count: " + store.Certificates.Count.ToString() + "<br>");

IIS和VS調試器在不同的用戶憑據下運行。 因此,IIS無法加載證書。 這是我的解決方法:

我將創建一個命令行實用程序並以用戶身份運行它

ASP.NET模擬可幫助加載用戶的證書。

PS:System.Security.Principal.WindowsIdentity.GetCurrent()。Name獲取用戶名。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM