【发布时间】: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