在localhost中运行时,Windows成功进行TFS身份验证,但在服务器中部署时发生错误

时间:2016-05-31 06:06:05

标签: c# iis visual-studio-2012 tfs server

   var tfsCredentials = new TfsClientCredentials(new Microsoft.TeamFoundation.Client.WindowsCredential(), true);
                TfsTeamProjectCollection teamCollection = new TfsTeamProjectCollection(new Uri(DomainConstants.BASE_ADDRESS), tfsCredentials);
                return teamCollection;

我用它从当前登录用户身份验证TFS并获取TfsTeamProjectCollection,它从visual studio(localhost)运行时工作正常,但是当我在Server中部署我的项目时出现错误

  

处理您的请求时出错

浏览器和错误日志

  

消息:TF30063:您无权访问   http://unicorntfs:8080/tfs/USP
StackTrace:at   Microsoft.TeamFoundation.Client.Channels.TfsHttpWebRequest.SendRequest()   在   Microsoft.TeamFoundation.Client.Channels.TfsHttpRequestChannel.Request(TfsMessage   消息,TimeSpan超时)at   Microsoft.TeamFoundation.Client.Channels.TfsHttpClientBase.Invoke(TfsClientOperation   operation,Object []参数,TimeSpan超时,对象[]&输出)
  在Microsoft.TeamFoundation.Server.Classification.ListProjects()at   Microsoft.TeamFoundation.Proxy.CommonStructureService.ListProjects()
  在   UnicornRMS.TimeManagement.Services.TFSTimeManagementServiceImpl.GetAllProjectsByUser(TfsTeamProjectCollection   projCollection)at   UnicornRSM.WEB.Controllers.TimeManagement.TimeManagementController.Index(的Int32   weekNo)

如何从当前登录用户

对TFS进行身份验证

由于

1 个答案:

答案 0 :(得分:0)

如果您要连接到域中的TFS服务器,则可以使用 NetworkCredential 进行身份验证:

var _credentials = new NetworkCredential(UserName, Password);

TfsTeamProjectCollection server = new TfsTeamProjectCollection(_tfsUri, _credentials);

server.EnsureAuthenticated();

此外,尝试删除已部署服务器上的IE缓存和cookie,然后再次尝试。

<强>更新

此问题可能与双跃点有关。一些类似的问题供您参考: