我编写程序来连接TFS服务器并从中获取项目。
_tfsClient = new TFS2013Client(new Uri("http://server-tfs.domain.local:8080/tfs/"), _logger);
public TFS2013Client(Uri tfsURI, ILogger logger)
{
_logger = logger;
TfsURI = tfsURI;
_configurationServer = TfsConfigurationServerFactory.GetConfigurationServer(TfsURI);
_server = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(TfsURI);
Version = _server.GetService<VersionControlServer>();//exception here
// Version = _server.GetService(typeof(VersionControlServer)) as VersionControlServer;
}
当我尝试获取Version
对象时,我得到例外:
An unhandled exception of type 'Microsoft.TeamFoundation.TeamFoundationServiceUnavailableException'
occurred in Microsoft.TeamFoundation.Client.dll
Additional information: TF31002: Unable to connect to this
Team Foundation Server: http://server-tfs.domain.local:8080/tfs.
Possible reasons for failure include:
- The name, port number, or protocol for the Team Foundation Server is incorrect.
- The Team Foundation Server is offline.
- The password has expired or is incorrect.
404 error code.
我可以将Visual Studio 2013连接到TFS服务器。服务器字符串为:http://server-tfs:8080/tfs
。它工作正常。
当我将这个地址设置为程序时,我有同样的错误。
你能帮助我 - 为什么我不能通过代码连接到TFS? 可能我应该在代码中授权一些方法吗?
谢谢!
P.S。当我在浏览器中键入此地址时,请转到TFS页面。
P.P.S。问题解决了:我使用这个地址:http://server-tfs.domain.local:8080/tfs/collectionName
答案 0 :(得分:1)
问题解决了:我使用这个地址:http://server-tfs.domain.local:8080/tfs/collectionName