Where is the root certificate located? I think ASP.NET will use the local computer store - perhaps the VS development server uses the user store and finds the root certificate there, but ASP.NET does not find it? Try adding the root certificate to local storage.
You can check the statuses in X509Chain to get more details:
foreach (X509ChainElement element in chain.ChainElements) { Console.WriteLine ("Element issuer name: {0}", element.Certificate.Issuer); Console.WriteLine ("Element certificate valid until: {0}", element.Certificate.NotAfter); Console.WriteLine ("Element certificate is valid: {0}", element.Certificate.Verify ()); Console.WriteLine ("Element error status length: {0}", element.ChainElementStatus.Length); Console.WriteLine ("Element information: {0}", element.Information); Console.WriteLine ("Number of element extensions: {0}{1}", element.Certificate.Extensions.Count, Environment.NewLine); if (ch.ChainStatus.Length > 1) { for (int index = 0; index < element.ChainElementStatus.Length; index++) { Console.WriteLine (element.ChainElementStatus[index].Status); Console.WriteLine (element.ChainElementStatus[index].StatusInformation); } } }
Randy levy
source share