Closed MartinRobins closed 2 years ago
A little more information; when sending some compressed requests, reading from the original Request.Content throws the exception (I have downloaded your source so that I can debug and tried intercepting it at various levels up the chain all the way up to BaseServerCompressionHandler.SendAsync; having opened the content using ReadAsStreamAsync any attempt to read results in OutOfMemoryException).
The error is however intermittent. If I send the request without compression (by setting the contentSizeThreshold of the ClientCompressionHandler to Int32.MaxValue), I am able to read the Request.Content within BaseServerCompressionHandler.SendAsync as would be expected.
The code being used to read within BaseServerCompressionHandler.SendAsync is simply...
byte[] buffer = new byte[4096];
int bytesRead;
Stream stream = await request.Content.ReadAsStreamAsync();
while (0 < (bytesRead = await stream.ReadAsync(buffer, 0, buffer.Length)))
Debug.WriteLine(bytesRead);
The size of the compressed request when it fails is in excess of 200Mb if that makes any difference.
M.
I have a WebAPI application (.NET 4.7.2) that works locally on Windows 10 but does not work when deployed to Windows Server 2012R2/IIS8.5. The only clue I can get from it is...
Any thoughts as currently I have no idea where to start?