ASP.NET Core web application returns different response headers for every request

245 Views Asked by At

Response Transfer-Encoding header's value is not always present. There is an ASP.NET Core(Razor) web app hosted on localhost. A small console application periodically(every 2-3 minutes) makes 45 HttpWebRequest to the web app for different resources(home page, other web pages, static images, js, CSS). Every time the console app compares the old page/image/css content and response headers, for the majority of resources there are no changes but for some of them, the response headers are different in 90% of cases.

response nr 1 headers:
"Content-Length" : "12714"
"Content-Type" : "text/html; charset=utf-8"
response nr 2 headers:
"Content-Type" : "text/html; charset=utf-8"
"Transfer-Encoding" : "chunked"
response nr 3 headers:
"Content-Length" : "12714"
"Content-Type" : "text/html; charset=utf-8"

Why does the ASP.NET Core response headers are almost always different? ASP.NET web app is hosted on IIS Express. One time the response is chunked and in this case, the Content-Length header is omitted, but why one time the response is chunked and another time not?

0

There are 0 best solutions below