How to read HTTP request headers in a WCF web service?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: In a WCF web service, how does one read an HTTP/HTTPS request header? In this case, i'm trying to determine the original URL host the client used. This might be in the X-Forwarded-Host header from a load balancer, or in the Host header if it's direct-box. I've tried OperationContext.Current.IncomingMessageHeaders.FindHeader but i think this is looking at SOAP headers rather than HTTP headers. So, how to read HTTP headers? Surely this is a simple question and i'm missing something obvious. EDIT - @sinfere's answer was almost exactly what i