Recently got into a discussion around how to figure out which WFE a user is connected to when you have 'Sticky sessions' disabled as is recommended in SharePoint 2016. Here are some choices that I came up with.
- We could add a response header (See Here) this would require that we use a sniffer on the client to capture the traffic so it might not be the most functional choice.
- Add HTML code to the MasterPage, Microsoft Best Practice suggests that you should stay away from editing your Master Page if at all possible.
- Another possibility is to use the SharePoint Developer Dashboard, this tool presents a lot of information (See here for more details) on a connection by connection basis. One of the properties is the server name 😊 You can enable this tool by running the following code on any SharePoint server in a PowerShell window.
$d = [Microsoft.SharePoint.Administration.SPWebService]::ContentService.DeveloperDashboardSettings $d.DisplayLevel = 'On' $d.TraceEnabled = $true $d.Update()
Once done with your troubleshooting it is recommended that you turn it off by running the following code on your SharePoint Server.
$d = [Microsoft.SharePoint.Administration.SPWebService]::ContentService.DeveloperDashboardSettings $d.DisplayLevel = 'Off' $d.Update()
As you can see from this screenshot in my test environment the tool can show you which WFE your connected for each connection.