Iis – New IIS site on Windows Server 2016 always returns 404 Not Found

iiswindows-server-2016

I am setting up a server with Windows Server 2016 for the first time, and when creating a new IIS website, I am finding that all requests return 404 Not Found.

Looking through the web server logs, there are no requests being logged. Looking at the HTTPERR log, I can see NotFound errors being logged, but the documentation that I have looked at (https://support.microsoft.com/en-us/help/820729/error-logging-in-http-apis) doesn't list NotFound as a supported error reason.

The app is a vanilla ASP.NET MVC application based on .NET Framework 4.6.2; I have tried placing an empty index.html in the application root folder and setting it as the default document, but that doesn't work either.

Here's a typical line from the logs:

2018-03-26 00:39:19 192.168.3.252 60475 192.168.3.11 443 HTTP/0.9 GET / - 404 - NotFound -

Two things are puzzling me from that log entry – why does it give the HTTP version as 0.9 instead of 1.1 or 2.0 as I would expect, and why does give the path as / instead of e.g. /index.html or /home/index as I would expect?

Best Answer

The logged path is always the one from the actual HTTP request, never a resulting path i.e. HTTP path after the rewrite or real filesystem path. This part of your log line is completely normal.

CookedURL + Query

The URL and any query that is associated with it are logged as one field that is separated by a question mark (0x3F). This field is truncated at its length limit of 4,096 bytes.

The HTTP/0.9 is just a result of a (either malformed or ancient) very simple GET / request without the HTTP/version part and additional request lines: the HTTP 0.9 was a one-liner protocol without any headers, including the Host: introduced in the HTTP 1.1 standard. The lack of Host: header means that the Default Web Site gets used instead of the binding your actual site has. If the default web site doesn't have index, the 404 - Not found may have been caused by that.

From the details in your question alone I can't deduce what could be causing such queries. Could there be something between the browser and the IIS?

Related Topic