我试图从我们的子版本打印日志消息。但我正在绕过无效的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避免使用临时目录。 –