Debug Windows Server 2016 IIS ‘ERROR 404 – File or Directory Not Found’

asp.netiisweb-serverwindowswindows-server-2012-r2

I can't get my ASP .NET web app running on my new AWS EC2 VM Windows Server 2016. Web app has been running on Azure VM Windows Server 2012 R2 for years.

THE PROBLEM:
I get:

"ERROR 404 – File or directory not found"

..when I try to browse from external Internet, or on the server itself, to my ASP.NET web app hosted on Windows Server 2016 IIS on a new AWS EC2 VM. Same error if I browse from IIS > Sites > my web site > Manage Website > Browse

When I remove and re-add web site, I get this error (also see screen shot below):

IIS > Add Website > Test Connection > yellow warning sign Cannot
verify access to path(path to my web app project)

ATTEMPTS TO FIX…
IIS > Connections > my_web_site > browse doesn't work: "The webpage cannot be found"
IIS > Connections > my_web_site > Manage Website > browse cmd gets Server Error 404 file or dir not found
IIS > Connections > my_web_site > Edit Bindings > browse gets Server Error 404 file or dir not found

I tried deleting IIS > Sites > my web site and then re-adding it. Still get error 404.

BACKGROUND…
ASP.NET works ok on previous Azure VM Windows Server 2012 R2.
ASP.NET app runs ok when I debug it from Visual Studio on new AWS VM.
All IIS bindings set up just like on previous Azure VM.

THE ERROR…
enter image description here

WEB APP'S IIS PROPERTIES………….
enter image description here

IIS LOGS in C:\inetpub\logs\LogFiles\

There are 3 subfolders:

W3SVC1\ which contains a file with this…..

    #Software: Microsoft Internet Information Services 10.0
#Version: 1.0
#Date: 2019-01-12 15:02:21
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken
2019-01-12 15:02:21 172.31.37.156 GET / - 80 - 52.15.212.41 Mozilla/5.0+(Windows+NT+10.0;+WOW64;+Trident/7.0;+rv:11.0)+like+Gecko - 404 3 50 78
#Software: Microsoft Internet Information Services 10.0
#Version: 1.0
#Date: 2019-01-12 15:54:19
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken
2019-01-12 15:54:19 172.31.37.156 GET / - 80 - 52.15.212.41 Mozilla/5.0+(Windows+NT+10.0;+WOW64;+Trident/7.0;+rv:11.0)+like+Gecko - 404 3 50 156
#Software: Microsoft Internet Information Services 10.0
#Version: 1.0
#Date: 2019-01-12 17:37:36
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken
2019-01-12 17:37:36 172.31.37.156 GET /wp-login.php - 80 - 185.234.217.208 Mozilla/4.0+(compatible;+MSIE+9.0;+Windows+NT+6.1;+125LA;+.NET+CLR+2.0.50727;+.NET+CLR+3.0.04506.648;+.NET+CLR+3.5.21022) http://prayshep.com/wp-login.php 404 0 2 171
2019-01-12 17:37:36 172.31.37.156 GET /wp-login.php - 80 - 185.234.217.208 Mozilla/4.0+(compatible;+MSIE+9.0;+Windows+NT+6.1;+125LA;+.NET+CLR+2.0.50727;+.NET+CLR+3.0.04506.648;+.NET+CLR+3.5.21022) http://prayshep.com/wp-login.php 404 0 2 125
2019-01-12 17:48:43 172.31.37.156 GET /Default.aspx - 80 - 73.70.70.121 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/64.0.3282.140+Safari/537.36+Edge/17.17134 - 404 3 50 93
#Software: Microsoft Internet Information Services 10.0
#Version: 1.0
#Date: 2019-01-12 23:31:12
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken
2019-01-12 23:31:12 172.31.37.156 GET / - 80 - 52.15.212.41 Mozilla/5.0+(Windows+NT+10.0;+WOW64;+Trident/7.0;+rv:11.0)+like+Gecko - 404 3 50 46
2019-01-12 23:31:13 172.31.37.156 GET / - 80 - 52.15.212.41 Mozilla/5.0+(Windows+NT+10.0;+WOW64;+Trident/7.0;+rv:11.0)+like+Gecko - 404 3 50 31
2019-01-12 23:34:18 172.31.37.156 GET / - 80 - 52.15.212.41 Mozilla/5.0+(Windows+NT+10.0;+WOW64;+Trident/7.0;+rv:11.0)+like+Gecko - 404 3 50 15
2019-01-12 23:38:39 172.31.37.156 GET / - 80 - 52.15.212.41 Mozilla/5.0+(Windows+NT+10.0;+WOW64;+Trident/7.0;+rv:11.0)+like+Gecko - 404 3 50 31

W3SVC2\ which contains a file with this…..

#Software: Microsoft Internet Information Services 10.0
#Version: 1.0
#Date: 2019-01-12 22:11:19
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken
2019-01-12 22:11:19 172.31.37.156 GET / - 80 - 52.53.201.78 Mozilla/5.0+(Macintosh;+Intel+Mac+OS+X+10_12_6)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/61.0.3163.100+Safari/537.36 - 404 3 50 109
#Software: Microsoft Internet Information Services 10.0
#Version: 1.0
#Date: 2019-01-12 23:39:21
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken
2019-01-12 23:39:21 172.31.37.156 GET / - 80 - 52.15.212.41 Mozilla/5.0+(Windows+NT+10.0;+WOW64;+Trident/7.0;+rv:11.0)+like+Gecko - 404 3 50 78
2019-01-12 23:40:11 172.31.37.156 GET / - 80 - 52.15.212.41 Mozilla/5.0+(Windows+NT+10.0;+WOW64;+Trident/7.0;+rv:11.0)+like+Gecko - 404 3 50 15
2019-01-12 23:43:17 172.31.37.156 GET / - 80 - 73.70.70.121 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/64.0.3282.140+Safari/537.36+Edge/17.17134 - 404 3 50 78

W3SVC3\ which contains a file with this…..

    #Software: Microsoft Internet Information Services 10.0
#Version: 1.0
#Date: 2019-01-12 23:32:18
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken
2019-01-12 23:32:18 ::1 GET / - 80 - ::1 Mozilla/5.0+(Windows+NT+10.0;+WOW64;+Trident/7.0;+rv:11.0)+like+Gecko - 404 3 50 109

IIS > Connections > my web site > Default Document
enter image description here

Directory of my ASP .NET web app

IIS > Add Website > Test Connection
enter image description here

Best Answer

Your domain seems to be pointed to the correct server and IIS is responing to your initial requests. The 404 error you're getting is generated by IIS.

Did you check the default document setting for the web app? It should match with your app default document, eg. default.aspx. Confirm that you're referring to the correct page which is your landing page in your Default document settings.

Also make sure you're running the correct version of the .NET framework intended for your web app. .NET Framework version can be updated from the Application Pools page in IIS.

Try removing the host name from binding and browse from the server itself(through the IIS console) to see if the application opens. In this case you'll only bind to the IP addresses available on the machine, with a blank host name. You will need to enter the IP in your browser when browsing from the public side.

Check your web.config(in your web app folder) configuration, sometimes these add additional configuration to IIS and cause unnecessary frustrations. If there's nothing of value in the web.config, try deleting the file from the web app folder and try again.

Other troubleshooting steps involve removing the entire app and just put in a basic index.html page in your web app folder. Update your default document settings to refer to this new page. Browse from IIS again.