views:

30

answers:

1

We're debugging intermittent issues with a website running on IIS7.

Since we have many nodes behind the load balancer, we can't tell which host responded to a given request. Is there any way at the IIS level to specify which host served a request? For example, could IIS append a header in the response that indicates the IP of the host that sent the response?

Ideally, I would like a solution that does not require any coding.

+1  A: 

Without writing any code you could just configure a custom HTTP Response Header for each machine in IIS Manager. You'd need to manually enter each IP address or identifier manually using either the GUI or APPCMD.EXE. This can be done globally for all sites:

appcmd.exe set config -section:system.webServer/httpProtocol 
              /+"customHeaders.[name='X-Custom-Name',value='MyCustomValue']"

Or for a single site:

appcmd.exe set config "Default Web Site" -section:system.webServer/httpProtocol 
              /+"customHeaders.[name='X-Custom-Name',value='MyCustomValue']"

I've split these commands over two lines just to fit them in. You should enter them as a single line.

Kev