I have a .NET Core 2.0 console app that does a GET request.
It seems like the published version does not send Accept-Encoding headers for compression on a test machine, but works on my local machine.
I cannot find any other pre-requesites that would make compression fail. Both are running the .NET Core 2.1.4 SDK.
I have tested the console app by running dotnet Console.dll in both environments.
- Publish in VS2017
- Go to output folder and run
dotnet Console.dll. Verify header present in Fiddler. - Copy entire output folder and deploy onto server
- Run
dotnet Console.dllagain and verify header missing on the server with Fiddler.
I have tried both HttpClient and RestSharp and I'm pretty perplexed.
Proof of concept that goes to a page that echoes the request headers:
var handler = new HttpClientHandler()
{
AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip
};
using (var client = new HttpClient(handler))
{
response = client.GetStringAsync("http://scooterlabs.com/echo").Result;
}
Local environment (Win10)
GET http://scooterlabs.com/echo HTTP/1.1
Connection: Keep-Alive
Accept-Encoding: gzip, deflate
Host: scooterlabs.com
Server (Win2008 R2 on AWS)
GET http://scooterlabs.com/echo HTTP/1.1
Connection: Keep-Alive
Host: scooterlabs.com
AutomaticDecompression)?