我使用SharpSVN并在subversion中添加了一个文件夹。然后我尝试提交它,我得到了这个例外:
SharpSvn.SvnRepositoryIOException: OPTIONS of 'https://sth.com/svn/blah/Documents': Server certificate verification failed: certificate has expired, certificate issued for a different hostname, issuer is not trusted
据我所知: Server certificate verification failed
..似乎我必须使用--trust-server-cert
选项,但我在SvnCommitArgs
的参数中没有看到这一点。
另外,我发现了这个: How do I use a custom Certificate Authority in SharpSvn without installing the certificate
..我在哪里看到:
client.Configuration.SetOption(...)
但我不知道我必须提供什么设置才能让它毫无问题地提交。
有没有人做过类似的事情?
修改: 我也尝试过这样做:
client.Authentication.SslServerTrustHandlers += new EventHandler<SharpSvn.Security.SvnSslServerTrustEventArgs>(Authentication_SslServerTrustHandlers);
void Authentication_SslServerTrustHandlers(object sender, SharpSvn.Security.SvnSslServerTrustEventArgs e)
{
// Accept ceritificate here?
}
但是我不明白我必须在处理程序中接受证书... :(
答案 0 :(得分:10)
行。我解决了这个问题,现在我又遇到了一个错误。 你需要做的是:
client.Authentication.SslServerTrustHandlers += new EventHandler<SharpSvn.Security.SvnSslServerTrustEventArgs>(Authentication_SslServerTrustHandlers);
void Authentication_SslServerTrustHandlers(object sender, SharpSvn.Security.SvnSslServerTrustEventArgs e)
{
// Look at the rest of the arguments of E, whether you wish to accept
// If accept:
e.AcceptedFailures = e.Failures;
e.Save = true; // Save acceptance to authentication store
}