tags:

views:

11

answers:

1

my wcfbinding is wshttpbind

A: 

You can try to use this code in your operation:

MessageProperties properties = OperationContext.Current.IncommingMessageProperties;
var httpProperty = properties[HttpRequestMessageProperty.Name] as HttpRequestMessageProperty;
int length = Int32.Parse(httpProperty.Headers["Content-Length"]);

Edit:

Response length is not known till the response data are serialized and message is formatted. By the architecture this happens out of the service class itself. You can try to create custom MessageEncoder and get content length in overriden WriteMessage method.

Ladislav Mrnka
thank you,but I want to get the response content-length
Raymond