SVN COPY错误:501方法未实现



我们已经使用VisualSVN(标准版)好几年了,没有遇到任何问题。我们有一个C#应用程序,它将数据存储在SVN中。它使用SharpSvn(https://sharpsvn.open.collab.net)用于SVN访问的库。偶尔,应用程序会执行服务器端SVN COPY命令(SharpSvn的"RemoteCopy"),以基于存储库中的一系列现有文件创建分支。

我们最近将VisualSVN从2.5.2版更新到3.2.2版,并购买了解锁产品企业功能的许可证。我们启用了集成Windows身份验证,但也保留了基本身份验证以实现向后兼容性。

在运行了一周没有任何问题(只执行从SVN的读取)后,我们的应用程序第一次尝试执行复制,但失败了,出现了以下错误,抱怨必须复制的一个文件:

"对'/svn/repository/!svn/rvr/12345/trunk/file.xml'的COPY请求失败:501方法未实现"

服务器日志显示以下内容:

Level,Date and Time,Source,Event ID,Task Category
Error,2015-03-03 9:37:26 AM,VisualSVN Server 3.2,1001,Apache,"Multi-author commits not supported.  [501, #175002] [client 192.168.1.100]"
Error,2015-03-03 9:37:26 AM,VisualSVN Server 3.2,1001,Apache,"Could not fetch resource information.  [501, #0] [client 192.168.1.100]"
Error,2015-03-03 9:37:26 AM,VisualSVN Server 3.2,1001,Apache,"SSPI Challenge failed: The token supplied to the function is invalid [client 192.168.1.100]"
Error,2015-03-03 9:37:21 AM,VisualSVN Server 3.2,1001,Apache,"SSPI Challenge failed: The token supplied to the function is invalid [client 192.168.1.100]"

重新启动VisualSVN服务后,命令完成,没有任何问题。以前VisualSVN的旧版本从未发生过这种情况。

这就是我们使用SharpSvn:创建分支的方式

    private static void Branch(ICollection<SvnUriTarget> sources, Uri targetUri, string comment, string userName, string password)
    {
        if (sources == null) throw new ArgumentNullException("sources");
        if (targetUri == null) throw new ArgumentNullException("targetUri");
        if (comment.IsNullEmptyOrSpaces()) throw new ArgumentNullException("comment");
        if (userName.IsNullEmptyOrSpaces()) throw new ArgumentNullException("userName");
        if (password.IsNullEmptyOrSpaces()) throw new ArgumentNullException("password");
        using (var client = new SvnClient())
        {
            client.Authentication.Clear();
            client.Authentication.DefaultCredentials = new NetworkCredential(userName, password);
            client.Authentication.SslServerTrustHandlers += (sender, e) => { e.AcceptedFailures = e.Failures; e.Save = true; };
            SvnCommitResult commitResult;
            if (!client.RemoteCopy(sources, targetUri, new SvnCopyArgs { CreateParents = true, LogMessage = comment }, out commitResult))
                throw new ApplicationException("Failed to create tag/branch in Repository");
        }
    }

在我们的应用程序中,我们仍然使用基本身份验证,并且凭据会显式传递给每个SharpSvn调用。应用程序向用户请求凭据,然后使用这些凭据执行"Branch"方法的单个调用。两个不同的用户尝试在两台不同的机器上使用自己的凭据进行此操作,结果相同。只有重新启动VisualSVN服务才解决了问题。我担心这个问题可能会再次出现。。。

如果要指定操作凭据,则应禁用SharpSvn(和Subversion)以使用集成身份验证('ntlm'和'negotiate')。

尝试添加这样的代码:

client.Configuration.SetOption("servers", "global", "http-auth-types", "basic");

这可能是Subversion、SharpSvn或serf中的一个错误,但所提出的解决方法应该有效。

最新更新