我目前正在为我的自托管 WCF REST 应用程序编写 GZIP 压缩。我有 .NET“MessageEncoder”类的自定义实现和“WebContentTypeMapper”类的自定义实现。
如何在“ReadMessage”函数和“GetMessageFormatForContentType”函数中检索 http header ?我想在解压缩输入之前检查传入的“Content-Encoding” header 请求。
谢谢。
最佳答案
这是你能做的
if (WebOperationContext.Current.IncomingRequest.Headers["Content-Encoding"] == WHAT YOU WANT)
{
// Do what you like to do here
}
希望这对您有所帮助。
谢谢。
关于c# - 在 WCF MessageEncoder 中获取 HTTP header ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12038961/