【问题标题】:Unauthorized access to TFS未经授权访问 TFS
【发布时间】:2015-03-05 07:01:25
【问题描述】:

我编写了一个 C# 代码,其 exe 在服务器上。此代码访问 TFS 以下载 TFS 上的一些文件夹。我正在尝试使用 powershell 从我的本地计算机上运行这个 exe(在服务器上)。 我得到错误:

Microsoft.TeamFoundation.TeamFoundationServerUnauthorizedException: TF30063: 您无权访问 --url of the tfs System.Net.WebException: The remote server returned an error: (401) Unauthorized

代码:

tfs = new TfsTeamProjectCollection(new Uri(ConfigurationManager.AppSettings["TFSProjectCollection"]), System.Net.CredentialCache.DefaultCredentials);    
vcs = tfs.GetService<VersionControlServer>();
w = vcs.CreateWorkspace(Environment.MachineName + "-" + g, tfs.AuthorizedIdentity.UniqueName);
w.Map(ConfigurationManager.AppSettings["TFSFolder"] + application, applicationFolder);

【问题讨论】:

  • @user1 的编辑并没有提高任何可读性,我们当然不会在帖子中添加“谢谢”。
  • 我怀疑,您需要为您的 PS 脚本提供正确的凭据。您的本地用户可能没有 TFS 的适当权限。

标签: c# powershell tfs


【解决方案1】:

删除将凭据传递给 TFS 的参数。如果您的本地用户有权限,它将自动获取它。

【讨论】:

  • 感谢您,TFS 电动工具 cmdlet 显然也是如此!
猜你喜欢
  • 2020-05-27
  • 1970-01-01
  • 1970-01-01
  • 2016-08-12
  • 2014-07-01
  • 2021-03-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多