我在IIS中启用了gzip。从失败的请求日志中我可以看到动态压缩是成功的。但响应头中没有内容编码。请提供解决方案,请参阅以下设置:
#include <stdio.h>
#include <math.h>
int main(int argc, char *argv[])
{
double x, result;
printf("Enter a positive number.\n");
scanf("&f", &x);
result = sqrt(x);
printf("The square root of %f is %f.\n", x, result);
return 0;
}
DYNAMIC_COMPRESSION_START GENERAL_SET_RESPONSE_HEADER HeaderName =&#34; Vary&#34;,HeaderValue =&#34; Accept-Encoding&#34;,Replace =&#34; false&#34; DYNAMIC_COMPRESSION_SUCCESS DYNAMIC_COMPRESSION_DO OriginalSize =&#34; 266271&#34;,CompressedSize =&#34; 30223&#34; DYNAMIC_COMPRESSION_END
web.config压缩设置:
Response Header
HTTP/1.1 200 OK
Cache-Control: private, max-age=0
Content-Type: application/json; charset=utf-8
Vary: Accept-Encoding
Server: Microsoft-IIS/8.5
X-Powered-By: ASP.NET
Date: Thu, 16 Feb 2017 16:12:04 GMT
Transfer-Encoding: chunked
Request Headers
Accept:application/json, text/javascript, */*; q=0.01
Accept-Encoding:gzip, deflate
Accept-Language:en-US,en;q=0.8
Content-Length:68
Content-Type:application/json; charset=UTF-8