1

私は奇妙な問題に直面しています.tfs apiを使用してプログラム的にtfsサーバーに接続したいです。適切な認証資格情報を与えた後でも失敗します.しかし、ブラウザにtfsサーバー名を入力して手動で行うと、接続されます.

コード:

TeamFoundationServer tfs = new TeamFoundationServer(new Uri("http://10.112.205.145:8080/tfs"),  new NetworkCredential(@"usrname", "pwd", "domain"));
tfs.EnsureAuthenticated()

提案してください。

4

3 に答える 3

4

これを行う簡単な方法は、"Syetem.Net" 名前空間をコードに追加してから、"CredentialCache" オブジェクトを使用することです。「DefaultCredentials」を使用すると、アクティブなユーザーの資格情報で認証されます。

// connect to the collection
using (TfsTeamProjectCollection teamProjectCollection = new TfsTeamProjectCollection("http://server:8080/tfs/DefaultCollection", CredentialCache.DefaultCredentials))
            { 
                //Do Stuff here 
            }
于 2012-12-13T14:06:08.937 に答える
1

このようにしてみましたか..

TfsTeamProjectCollection collection = new TfsTeamProjectCollection(
    new Uri(http://server:8080/tfs/DefaultCollection,
    new System.Net.NetworkCredential("domain_name\\user_name", "pwd"));
collection.EnsureAuthenticated();
于 2012-12-13T07:06:55.667 に答える