An error occurred while sending the request in TFS

2019-05-18 08:58发布

问题:

While configuring a TFS vNext build agent i am getting the error:

ErrorConnectingToTheServer An error occurred while sending the request. the request.

I could not find any other error message in the event log or anywhere else.

Please help.

Update1: The SSL (https///tfs) did not work.but the plain http:// worked.

Update 2: I have removed the old agents and trying to configure new one. While doing that i am getting the below error that is present in the _diag folder:

System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host .... System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host .... System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host .... System.Net.Sockets.SocketException (0x80004005): An existing connection was forcibly closed by the remote host

Update 3: I have two servers as below: 1 is application server and other is SharePoint and reporting server trying to configure the build in 3rd server. TFS URL is configured with SSL 443.

If I try to configure the agent using http://tfs server/tfs it succeeds, but receives error while building. When i try to configure using https i get the above error. Interestingly I had used this server for two agents, and in that case i had one more server where i am getting the error was working properly.

回答1:

I finally found the solution to the issue:

Root cause: TFS vNext agents use .Net framework 4.5... which by default does not support TLS 1.1/ TLS 1.2.

Solution: We need to modify .Net framework registry entry to direct .Net framework to use TLS 1.2. Use the command to update the registry:

reg add HKLM\SOFTWARE\Microsoft\.NETFramework\v4.0.30319 /v SchUseStrongCrypto /t REG_DWORD /d 1 /reg:64 (and/or /reg:32)

Referred here:

https://stackoverflow.com/a/28502562/2939996



回答2:

If next time you have encountered some issues during the build agent configuration. For trouble shooting you could check related configuration logs. To see what was going on, you just go to the folder where the agent was installed. In that folder, a _diag folder exists with logging.

The “ServerUrl” setting of agent listed the default URL for TFS. Which default is HTTP on port 8080. According to your update, if you have changed your configuration to run on HTTPS. So, your TFS was not at 8080, but some others such as 443. And you or other co-workers configured the build agent before changed to HTTPS.

If so, you may need to update the “settings.json” file in the build agent folder and replace the old URL with the new one. After changing this file, restart the build agent service, then go back to the Agent Pools, refresh the page.