2012-12-14 32 views
9

を働いていない私は、C#で、次のコードを持っている:SVNリポジトリ認証 - 資格情報は

1. public static void Main(string[] args) { 
2. Uri repository = new Uri("https://svnserver:port/svn/Src/trunk"); 
3. using (SvnClient client = new SvnClient()) {     
4. client.Authentication.Clear(); 
5. client.Authentication.DefaultCredentials = new System.Net.NetworkCredential("user", "pass"); 
6. 
7. System.Collections.ObjectModel.Collection<SvnLogEventArgs> logEntries; 
8. SvnLogArgs logArgs = new SvnLogArgs(); 
9. logArgs.Limit = 1; 
10. client.GetLog(repository, logArgs, out logEntries); 
11. } 
12. } 

私はライン4と5を削除する場合は、このコードはどんな問題なく動作します。私はTortoiseSVNからローカルに保存した資格情報を使っていると仮定しています。しかし、私はこれをサーバー環境で実行したいので、特にユーザー名/パスワードを渡す必要があります。しかし、できるだけ早く私は10行に次のエラーを取得し、ログイン資格情報を入れしようとして:

SharpSvn.SvnRepositoryIOException was unhandled 
Message: Unable to connect to a repository at URL 

私はここで間違って何をしているのですか?使用しようとしているユーザー名/パスワードが機能することを確認しました。私は答えを見つけた

答えて

14

... 5行目の後にこれを追加します。

client.Authentication.SslServerTrustHandlers += delegate(object sender, SvnSslServerTrustEventArgs e) { 
        e.AcceptedFailures = e.Failures; 
        e.Save = true; // Save acceptance to authentication store 
       }; 
+1

私はこのエラーになっている:「これ以上の資格情報をか、我々はあまりにも多くのtimes.Authenticationが失敗しようとしました」 –

関連する問題