Tip: How to determine which SharePoint web front end you’re hitting


Have you ever set up a SharePoint farm with multiple WFEs (web front ends) and then wondered later which server you were hitting?  Ever have a user get an error but you can’t recreate it, only find to find out much later it’s because the user was hitting a different WFE than you were and that particular WFE was the only one with the error?  Or have you ever had a misconfigured hardware load balancer that is directing all of the traffic to just one poor overloaded WFE while the others sit there idle?

I have and it can be pretty frustrating to debug.

So I’ve found two different techniques you can use to determine which WFE your hitting.  The first technique is to use different HTTP headers for each WFE and then a tool, like Fiddler, to read the headers.  I found this idea here.  This technique is easy to implement and works great for technically savvy people. 

The next technique is for when you need to determine the WFE answering the request without using a tool like Fiddler (say when you’re at the end user’s desk and looking over their shoulder).

First, I created three small graphic files, each was three pixels wide and one pixel high.  In the first one, I made one pixel black.  In the second one, I made two pixels black, and as you might expect, in the third file I made three pixels black.

Second, I named each file the same (WFE.gif) and then copied one file to each WFE.  In our farm, we had a WFE1, WFE2, and WFE3, so I copied the file with one pixel to WFE1, and two to WFE2, and three to WFE3.  I placed these files in the SharePoint images directory.  (On my server, here: C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\IMAGES , but yours may differ.)

Lastly, I added the image to the footers I used on my sites.  With the images all named the same, the WFEs just look to their images directory for the WFE.gif file.  However, since the graphics are different on each WFE, you can now easily determine which WFE served up your page!  Just look for the one, two, or three dots in your footer.

I was using the SharePoint publishing template, so I was able to have the same footer on all of my pages.  If you’re not using the Publishing template, then you can do something similar by adding the graphic to your master page or adding an image viewer webpart to the pages.

One thing to note: this broke my rule/best practice of deploying code using SharePoint solutions files (WSPs).  I couldn’t deploy the graphics because SharePoint would have deployed the same file to each WFE, which is normally what you want – WFEs that are exactly the same.  Also, when you add a new WFE, you’ll have to create a new unique graphic for it.  Until you do, you’ll see the red X image not found, since the WFE.gif won’t exist.

I’m also curious if others have different ways to tell WFEs apart?  If so, I’d like to hear about it in the comments.

Print | posted @ Friday, October 29, 2010 10:25 AM