none
How to get the WCF 4.0 Restful response bandwidth consumed? RRS feed

  • Pergunta

  • Hi everyone,

    I have a WCF 4.0 restful application and I need to know the size of the HTTP message before it's sent back to the client.

    I have two methods as shown below and both have the token parameter that identify the client. So, when the client calls any method, I need to discover the size of the response and register the bandwidth consumption for that client and method.

    Note that the response may return as XML/JSON and compressed either.


    Could somebody give me a hand?

    	[ServiceContract]
    	[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    	[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Single, Namespace = "")]
    	public class ZipCodeService
    	{
    		[WebGet(UriTemplate = "/GetAddressByZipCode?token={token}&zipcode={zipcode}")]
    		public GetAddressByZipCodeContract GetAddressByZipCode(string zipCode, string token)
    		{
    			// ...
    		}
    
    		[WebGet(UriTemplate = "/GetZipCodeByAddress?token={token}&keywords={keywords}")]
    		public GetZipCodeByAddressContract GetZipCodeByAddress(string keywords, string token)
    		{
    			// ...
    		}
    	}


    Any help will be really appreciated.


    Regards,

    Fernando Môra

    Fernando Môra

    sexta-feira, 21 de dezembro de 2012 15:03