C# SVN复制错误:未实现501方法

C# SVN复制错误:未实现501方法,c#,svn,visualsvn-server,sharpsvn,C#,Svn,Visualsvn Server,Sharpsvn,我们已经使用VisualSVN(标准版)几年了,没有任何问题。我们有一个C#应用程序,它将数据存储在SVN中。它使用SharpSvn()库进行SVN访问。有时,应用程序会执行服务器端SVN COPY命令(SharpSvn的“RemoteCopy”),以基于存储库中现有的一系列文件创建分支 我们最近将VisualSVN从2.5.2版更新为3.2.2版,并购买了一个许可证来解锁产品的企业功能。我们启用了集成的Windows身份验证,但也保留了基本身份验证以实现向后兼容性 在运行了一周而没有任何问题(

我们已经使用VisualSVN(标准版)几年了,没有任何问题。我们有一个C#应用程序,它将数据存储在SVN中。它使用SharpSvn()库进行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");
        }
    }
私有静态无效分支(ICollection源、Uri targetUri、字符串注释、字符串用户名、字符串密码)
{
如果(sources==null)抛出新的ArgumentNullException(“sources”);
如果(targetUri==null)抛出新的ArgumentNullException(“targetUri”);
if(comment.IsNullEmptyOrSpaces())抛出新的ArgumentNullException(“comment”);
如果(userName.IsNullEmptyOrSpaces())抛出新的ArgumentNullException(“用户名”);
if(password.IsNullEmptyOrSpaces())抛出新的ArgumentNullException(“密码”);
使用(var client=new SvnClient())
{
client.Authentication.Clear();
client.Authentication.DefaultCredentials=新的网络凭据(用户名、密码);
client.Authentication.SslServerTrustHandlers+=(发送方,e)=>{e.AcceptedFailures=e.Failures;e.Save=true;};
SvnCommitResult commitResult;
if(!client.RemoteCopy(sources,targetUri,new SvnCopyArgs{CreateParents=true,LogMessage=comment},out commitResult))
抛出新的ApplicationException(“未能在存储库中创建标记/分支”);
}
}
在我们的应用程序中,我们仍然使用基本身份验证,并且凭证被显式地传递给每个SharpSvn调用。应用程序向用户请求凭据,然后使用这些凭据执行“Branch”方法的单个调用。
两个不同的用户尝试在两台不同的计算机上使用自己的凭据执行此操作,结果相同。只有重新启动VisualSVN服务才能修复此问题。我担心这个问题可能会再次出现…

如果要指定操作的凭据,您应该禁用SharpSvn(和Subversion)以使用集成身份验证(“ntlm”和“协商”)

尝试添加如下代码:

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

这可能是Subversion、SharpSvn或serf中的一个bug,但建议的解决方案应该可以解决。

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