【问题标题】:SVN COPY error: 501 Method Not ImplementedSVN COPY 错误:501 方法未实现
【发布时间】:2015-03-04 21:33:32
【问题描述】:

我们已经使用 VisualSVN(标准版)几年了,没有任何问题。我们有一个在 SVN 中存储数据的 C# 应用程序。它使用 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’的复制请求失败: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 调用。应用程序向用户请求凭据,然后使用这些凭据执行“分支”方法的一次调用。 两个不同的用户尝试在两台不同的机器上使用他们自己的凭据执行此操作,结果相同。只有重新启动 VisualSVN 服务才能解决问题。我担心这个问题可能会再次出现......

【问题讨论】:

  • @Ken White:我看过这个,我不知道它与我的问题有什么关系,即使错误信息是一样的。
  • 您是否在 httpd-custom.conf 中进行了任何自定义?您使用的是哪个版本的 SharpSvn?
  • @ivanzhakov:不,我们没有触及 httpd-custom.conf。我们使用 SharpSvn 版本 1.8008.3178.19,但我们也尝试了 1.8009.3299.43,结果相同。
  • @kazakm 可能是您在 %APPDATA%\Subversion\auth 中缓存了凭据?据我了解日志消息,情况如下:第一个请求使用一个凭据执行,第二个请求使用另一个(缓存?)凭据。安全日志中是否有任何相关错误?

标签: c# svn visualsvn-server sharpsvn


【解决方案1】:

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

尝试添加这样的代码:

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

这可能是 Subversion、SharpSvn 或 serf 中的错误,但建议的解决方法应该可行。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-03-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-07
    • 2014-09-28
    • 2021-08-15
    • 2017-10-09
    相关资源
    最近更新 更多