c# - Web API not compressing response content? -


I have a WebAPI and I configure Compression in WebApiConfig:

  config .messageHandlers.Add (new server compressor handler (new gizip compressor), new deflector ());  

In my winforms client, I use a HTTP client like this:

  WebRequestHandler handler = New WebRequestHandler () {AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate,}; Client = HttpClientFactory.Create (New Client Component Handler (Handler, New GizP Compressor), New DeflectCompressor ())); Client.BaseAddress = new URI (serverUrl); Client.DefaultRequestHeaders.AcceptEncoding.Add (New StringWithQualityHeaderValue ("gzip")); Client.DefaultRequestHeaders.AcceptEncoding.Add (new stringwidth quality header value ("deflate")); Client.DefaultRequestHeaders.Accept.Add (New MediaTypeWithQualityHeaderValue ("App / Jason"));  

Both server and client project references:

When I request an API, the length of the content is always the same without compression or without. So I do not know if the content has been compressed or not.

The specific IIS applicationhost.config for compression looks like this:

   & Lt; DynamicTypes & gt; & Lt; Add mimeType = "text / *" enabled = "true" /> & Lt; MimeType = "message / *" enabled = "true" /> & Lt; MimeType = "application / x-javascript" enabled = "true" /> & Lt; MimeType = "* / *" enabled = "wrong" /> & Lt; MimeType = "App / Jason" enabled = "true" /> & Lt; MimeType = "application / xml; charset = utf-8" enabled = "true" /> & Lt; / DynamicTypes & gt; & Lt; StaticTypes & gt; & Lt; Add mimeType = "text / *" enabled = "true" /> & Lt; MimeType = "message / *" enabled = "true" /> & Lt; MimeType = "app / x-javascript" enabled = "true" /> & Lt; MimeType = "application / atom + xml" enabled = "true" /> & Lt; MimeType = "application / xaml + xml" enabled = "true" /> & Lt; MimeType = "* / *" enabled = "wrong" /> & Lt; / StaticTypes & gt; & Lt; / HttpCompression & gt; I'm checking% TEMP% folder and there is no subfolder named ISExpress, so I have to admit that compression is not enabled by using the above config. 

Is there a way to check that the material has been compressed before it is being datilized?

And if the code above, does the API compress the response? Or is this a setting in IIS Express?


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -