我可以访问我服务器上的特定TFS项目。我想使用TFS API以编程方式访问此项目。我看不到直接访问项目的方法,而是我必须通过TfsTeamProjectCollection。但是,当我尝试对TfsTeamProjectCollection进行身份验证时,我被拒绝了权限。当我收到Authenticate()
方法时,我收到此错误:
An unhandled exception of type
'Microsoft.TeamFoundation.TeamFoundationServiceUnavailableException' occurred in
Microsoft.TeamFoundation.Client.dll
Additional information: HTTP code 407: Proxy Authentication Required
这是我的代码:
const string destProjectName = "Test_Dest";
var destUri = new Uri("https://mytfs.server.com:####/tfs/MyProjectCollection");
var destBasicCreds = new BasicAuthCredential(new NetworkCredential("domain\username", "password"));
var destCreds = new TfsClientCredentials(destBasicCreds) { AllowInteractive = false };
var destTpc = new TfsTeamProjectCollection(destUri, destCreds);
destTpc.Authenticate();
我已尝试过BasicAuthCredential和WindowsCredential,并获得相同的错误。还有什么我应该尝试的吗?