【问题标题】:Thread aborting issue with Sharp Svn with C#.Net 4.0使用 C#.Net 4.0 的 Sharp Svn 的线程中止问题
【发布时间】:2013-08-13 07:05:53
【问题描述】:

我使用 VS-2010、C#.Net 4.0 和 SharpSvn dll 开发了 ASP.net 应用程序。当我使用开发服务器(没有 3 层架构)时,它工作正常。但是当我们使用 QA 环境(具有 3 层架构)时,它大部分时间都会给出线程中止异常。以下显示了我拥有的代码和错误日志。对此的任何帮助都非常感谢。

public bool Checkout(string svnurl, string target)
    {
       try
        {
            using (_client = new SharpSvn.SvnClient())
            {
                _client.LoadConfiguration(Path.Combine(Path.GetTempPath(), "Svn"), true);
                _client.Authentication.DefaultCredentials = new TNetworkCredential(_username, _password);
                _client.Authentication.SslServerTrustHandlers += SvnSslOveride;
                var targetsvn = new SvnUriTarget(svnurl);

                if (_client.CheckOut(targetsvn, target))
                {
                    Log.Info("Successfully checked out to following location : " );
                    Log.Info(target);
                    return true;
                }
            }
            Log.Info("Unable to checkout "+ svnurl +" Svn location to target location : ");
           Log.Info(target);
            return false;
        }
        catch (Exception ee)
        {
            Log.Error("Error:SvnClient checkout....");
            Log.Error(ee);
            throw ee;
            return false;
        }
    }

private static void SvnSslOveride(object sender, SvnSslServerTrustEventArgs e)
        {
            e.AcceptedFailures = e.Failures;
            e.Save = true;
        }

错误日志

错误 2013-08-12 12:13:37,714 3223821ms SvnClient 结帐 - 错误:SvnClient 结帐....错误 2013-08-12 12:13:37,730 3223837ms SvnClient Checkout - System.Threading.ThreadAbortException:线程是 被流产。在 svn_client_checkout3(Int32* , SByte* , SByte* , svn_opt_revision_t* , svn_opt_revision_t* , svn_depth_t , Int32 , Int32 , svn_client_ctx_t* , apr_pool_t* ) 在 SharpSvn.SvnClient.CheckOut(SvnUriTarget url,字符串路径, SvnCheckOutArgs 参数,SvnUpdateResult& 结果)在 SharpSvn.SvnClient.CheckOut(SvnUriTarget url, 字符串路径)

【问题讨论】:

  • 当我使用不在 plink 身份验证缓存中的服务器从 http 切换到 svn+ssh 时,我看到了同样的异常。我认为使用 plink 服务器进行身份验证很困难,但我不知道如何修复它。这符合你的经验吗?

标签: asp.net visual-studio-2010 c#-4.0 sharpsvn


【解决方案1】:

我错过了<httpRuntime executionTimeout="(time in seconds)"> Web 配置中的标记,它由 IIS 服务器自动设置。默认值为 110 秒。 注意:在 .NET Framework 1.0 和 1.1 中,默认值为 90 秒。 在我将以下行添加到 web.config 之后,它工作正常。

<httpRuntime executionTimeout="600">

以前它有时会起作用,因为由于存储库和网络连接的大小,在 DEV 服务器中进行 SVN 签出所需的时间比在其他环境中要少。谢谢大家的回答

【讨论】:

    【解决方案2】:

    根据我上面的评论,我已经看到了这个问题。它似乎与 plink 身份验证有关。

    我通过升级到最新版本的 SharpSVN v1.7 解决了这个问题,此时错误从 C++ 中的空引用异常变为带有消息“无法创建隧道:参数”的 SVN 异常不正确”。

    有几篇文章解释了如何解决这个问题,我在这里找到了最好的:

    SVN+SSH and Sourceforge

    在我的情况下,将 SVN_SSH 环境变量中的反斜杠更改为正斜杠解决了这个问题。值得一试。

    【讨论】:

    • 谢谢。我认为我们有不同的问题。我已解决并更新答案。
    猜你喜欢
    • 2015-03-03
    • 2011-07-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-05-19
    • 1970-01-01
    • 2010-12-16
    相关资源
    最近更新 更多