Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# SharpSVN-服务器证书验证失败_C#_Certificate_Commit_Sharpsvn - Fatal编程技术网

C# SharpSVN-服务器证书验证失败

C# SharpSVN-服务器证书验证失败,c#,certificate,commit,sharpsvn,C#,Certificate,Commit,Sharpsvn,我使用SharpSVN并向subversion添加一个文件夹。然后我尝试提交它,得到了以下异常: SharpSvn.SvnRepositoryIOException:选项'https://sth.com/svn/blah/Documents“:服务器证书验证失败:证书已过期,为其他主机名颁发的证书,颁发者不受信任 我在这里看到: …似乎我必须使用--trust server cert选项,但在SvnCommitArgs的参数中我看不到这一点 此外,我发现: …在我看来: client.Con

我使用SharpSVN并向subversion添加一个文件夹。然后我尝试提交它,得到了以下异常:

SharpSvn.SvnRepositoryIOException:选项'https://sth.com/svn/blah/Documents“:服务器证书验证失败:证书已过期,为其他主机名颁发的证书,颁发者不受信任

我在这里看到:

…似乎我必须使用
--trust server cert
选项,但在
SvnCommitArgs
的参数中我看不到这一点

此外,我发现:

…在我看来:

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?
    }
client.Authentication.SslServerTrustHandlers+=新事件处理程序(Authentication\u SslServerTrustHandlers);
无效身份验证\u SslServerTrustHandlers(对象发送方,SharpSvn.Security.SvnSslServerTrustEventArgs e)
{
//在这里接受证书吗?
}

但我不明白我必须在处理程序中做什么才能接受证书…:(

好的。我解决了这个问题,现在又出现了一个错误。 您需要做的是:

    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
    }
client.Authentication.SslServerTrustHandlers+=新事件处理程序(Authentication\u SslServerTrustHandlers);
无效身份验证\u SslServerTrustHandlers(对象发送方,SharpSvn.Security.SvnSslServerTrustEventArgs e)
{
//看看E的其余参数,不管你是否愿意接受
//如果接受:
e、 AcceptedFailures=e.故障;
e、 Save=true;//将接受保存到身份验证存储
}

确保您还查看了“E”的另一个参数并检查。这允许所有SSL证书(也包括过期、吊销等)