I'm hosting an ASP.NET WebApi application in IIS 7.5 (Express) with Windows Authentication enabled and try to access it with HttpClient (version 2.0.20710.0 from NuGet). The server has been configured to perform gzip compression on JSON responses via applicationHost.config and I'm setting the AutomaticDecompression property on the client to Gzip.<br /><br />As the request needs to go through challenge-response authentication, multiple requests are performed between IIS and my client. After looking at the requests through Fiddler, it seems that the Accept-Encoding header value is duplicated with each request (see attached screenshots):<br /><br />Request 1: Accept-Encoding: gzip<br />Request 2: Accept-Encoding: gzip, gzip<br />Request 3: Accept-Encoding: gzip, gzip, gzip<br /><br />Please note that despite this, the request completes successfully and HttpClient automatically decompresses the gzipped result.<br /><br />Here's my client code:<br />var clientHandler = new HttpClientHandler<br /> {<br /> AutomaticDecompression = DecompressionMethods.GZip, <br /> Credentials = CredentialCache.DefaultCredentials<br /> };<br /> var httpClient = new HttpClient(clientHandler) { BaseAddress = new Uri("http://machinename:8888") };<br /> httpClient.GetStringAsync("api/version").Wait();
↧