我試圖從我們的子版本打印日誌消息。但我正在繞過無效的SSL證書而掙扎。這是錯誤:忽略無效SSL證書
OPTIONS of ' https://xxxxx/svn/SiteFabrics/trunk/AppLaunch/Bloc/Frontend ': Server certificate verification failed: certificate issued for a different hostname, issuer is not trusted (https://xxxx)
我忽略證書錯誤的嘗試是加入這一行:
ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
但是這並沒有任何區別的.NET錯誤仍然是相同的。下面是代碼,任何人都可以看到我做錯了什麼?
using (SvnClient client = new SvnClient())
{
Collection<SvnLogEventArgs> list;
client.Authentication.DefaultCredentials = new NetworkCredential("user", "pass");
ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
SvnLogArgs la = new SvnLogArgs(); //{ Start=128; End=132; };
client.LoadConfiguration(Path.Combine(Path.GetTempPath(), "Svn"), true);
client.GetLog(new Uri("https://[svnurl]"), la, out list);
ViewBag.SVNLog = list;
}
您是否看過這篇文章?:http://stackoverflow.com/questions/3099392/svn-repository-authentication-using-sharpsvn – Tomas
在最近的SharpSvn版本中,您可以使用.UseDefaultConfiguration()代替.LoadConfiguration避免使用臨時目錄。 –