Last post Feb 16, 2016 11:47 PM by markgma
Feb 16, 2016 05:48 PM|markgma|LINK
I have a web service to retrieve Certificate info from LocalMachine's Trusted Root Certification. It works on Win 2008 R2 web server, but crashes on Win 2012 Server R2.
Here is the code:
Dim store As X509CertificateStore = Nothing
Dim col As X509CertificateCollection
store = X509CertificateStore.LocalMachineStore(X509CertificateStore.TrustStore)
col = CType(store.FindCertificateBySubjectString("My Certificate Serial"), X509CertificateCollection)
The web service crashed at the line - calling FindCertificateBySubjectString()
The err msg is "Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
The same func code can work correctly when executing it within a Windows standalone app on Win 2012 server.
Thank you in advance
Feb 16, 2016 07:54 PM|mgebhard|LINK
Does IIS have access to the cert store?
Feb 16, 2016 11:47 PM|markgma|LINK
No luck after having many kinds of trying.
The cert i had imported into Personal is not marked as private key, therefore, the menu "Manage private key" menu is not shown.