Web API not found (404) for .net Core development IIS issue

Robin McAninch 21 Reputation points
2021-06-25T20:04:27.053+00:00

We developed a web api in .net core and deployed it to our test server (hosted in IIS) with no issue. It is callable from Postman and all seemed good. We now have a new server that would be the PROD server Windows 2019 with IIS installed. I added .net core hosting bundle (correct version), create an integrated v4.0 app pool, created the new site (with correct bindings), set up the deployment directory structure like the test box. I next pushed using devops the exact same build that was running on test. The site does not appear to work throwing a 404 for everything - even locally on the box. There are no event viewer errors. To troubleshoot I temporarily allowed directory browsing and added a test.html page to the directory. The IIS logs show the directory browse and the static page are working as expected

IIS Logs result (All Localhost below)

-- Key

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

-- Directory
2021-06-25 19:10:39 ::1 GET / - 44335 - ::1 Mozilla/5.0+(Windows+NT+10.0;+WOW64;+Trident/7.0;+rv:11.0)+like+Gecko - 403 14 0 1

test page
2021-06-25 19:02:34 ::1 GET /test.html - 44335 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/91.0.4472.124+Safari/537.36 - 200 0 0 2

this is the unsecured weatherforecast page from the seed project you get with .net core

2021-06-25 19:02:54 ::1 GET /api/v1/weatherforecast - 44335 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/91.0.4472.124+Safari/537.36 - 404 0 2 0

Any other controller method I try gives me 404 errors as well. I looked up the 2 and it is missing file as well. I saw that when I got the box that the ISAPI Filters were only the ASP.Net_2.0.50727.0 and ASP.Net_2.0.50727-64 so I added in the aspnet_filter.dlls for the 4.0.30319 framework but this doesn't seem to have made any difference. There is no other site on this box. I have done multiple IIS resets and restarts and a couple of reboots.

I cannot seem to find anything online that mimics this issue. The site seems up but not responding to .net Core API calls if it renders the basic .html test page. Did I miss installing something beyond the hosting bundle? We have set up about 5 boxes previously and never seen this behaviour.

Thanks in Advance

Internet Information Services
{count} votes