在WCF Rest HEAD调用中,Content-Length重置为零. [英] Content-Length is resetting to zero in WCF Rest HEAD call.
问题描述
我试图在HTTPResponseHeaders的HEAD方法调用中为Content-Length头设置一些值.但是,当我们从提琴手查询时,得到的Content-Length为零.看起来像WCF框架是 重置为零,因为没有响应.
I was trying to set Content-Length header with some value in HTTPResponseHeaders for HEAD method call. However when we query from fiddler we are getting Content-Length as zero in response. Look like WCF framework is resetting to zero as there is no body in response.
您能否建议我们如何获得实际的Content-Length.
推荐答案
嗨Malli_b,
Hi Malli_b,
对于网络获取响应流,通常我们只需要设置contentType和
As for the web get response stream, generally we only need to set the contentType and
编码头.对于"ContentLength",我们不需要自己设置.
encoding header. And for "ContentLength", we do not need to set it ourselve.
Web Resposne运行时将根据响应帮助计算该值.数据.
The web resposne runtime will help calculate this value according to the response data.
最好的问候,
Grady
这篇关于在WCF Rest HEAD调用中,Content-Length重置为零.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!