The point of a HEAD request is to return a Content-Length header, but with an empty body. The WCF transport stack has the annoying ‘feature’ that it ‘corrects’ the Content-Length header based on the stream that is returned. With the aid of Carlos Figueira’s MyLengthOnlyStream i was able to workaround that ‘feature’
(I know, i know, a good old HttpHandler is so much easier to implement!)
WCF REST: generate correct Content-Length header for HEAD request
Uncategorized
Leave a comment ?
Did you ever try:
WebOperationContext.Current.OutgoingResponse.SuppressEntityBody = true;
??
No. And I hope I never have to go back to that painful piece of code