How to identify which web server in a farm served a request?
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 exa开发者_Python百科mple, 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.
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.
精彩评论