我正在以编程方式检查TFS中的一些文件,在每次结账之前,我会检查是否已通过身份验证。某些文件已正确检出但在一个文件上,Authenticate()方法失败,并出现以下异常:
Microsoft.TeamFoundation.TeamFoundationServerInvalidResponseException: Wenden Sie sich an den Administrator. Fehler bei der Anforderung an den Server.
Technische Informationen (für Administrator):
HTTP-Code 200: OK
bei Microsoft.TeamFoundation.Client.Channels.TfsHttpWebRequest.ReadMessage(HttpWebResponse webResponse, WebException webException, Stream responseStream, Boolean& closeResponse)
bei Microsoft.TeamFoundation.Client.Channels.TfsHttpWebRequest.ReadResponse(HttpWebResponse webResponse, WebException webException)
bei Microsoft.TeamFoundation.Client.Channels.TfsHttpWebRequest.IsAuthenticationChallenge(TfsMessage requestMessage, HttpWebResponse webResponse, WebException webException, TfsMessage& responseMessage)
bei Microsoft.TeamFoundation.Client.Channels.TfsHttpWebRequest.SendRequest()
bei Microsoft.TeamFoundation.Client.Channels.TfsHttpRequestChannel.Request(TfsMessage message, TimeSpan timeout)
bei Microsoft.TeamFoundation.Client.Channels.TfsHttpClientBase.Invoke(TfsClientOperation operation, Object[] parameters, TimeSpan timeout, Object[]& outputs)
bei Microsoft.TeamFoundation.Framework.Client.LocationWebService.Connect(Int32 connectOptions, Int32 lastChangeId, Int32 features)
bei Microsoft.TeamFoundation.Framework.Client.FrameworkServerDataProvider.Connect(ConnectOptions connectOptions)
bei Microsoft.TeamFoundation.Client.TfsConnection.EnsureProviderConnected()
有没有人有想法,为什么我在这里得到InvalidResponse
?
我通过NuGet使用最新的TFS客户端程序集。
身份验证基本上是这样完成的:
m_tfsServer = new TfsTeamProjectCollection(new Uri(serverUri), new TfsClientCredentials());
if(!m_tfsServer.HasAuthenticated)
m_tfsServer.Authenticate();
答案 0 :(得分:2)
通常我会按照以下方式进行:
string STRuri=@"http://myserver/teamservercollection"
TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(new Uri(STRuri));
VersionControlServer vcs = tpc.GetService<VersionControlServer>();
Workspace workspace = vcs.GetWorkspace(System.Environment.MachineName, vcs.AuthenticatedUser);