I have a standard .NET Core REST API developed in c#. I created the project straight from Visual Studio 2022 and did no changes to the skeleton it created. If I run it from the IDE in SWAGGER I get the API for WeatherForecast and this tests just fine in swagger and provides the results I would expect. As soon as I publish this to an IIS site however I get a 404 not found - So:
- from Swagger I enter https://localhost:7050/WeatherForecast and this works fine.
- I then publish it to an IIS site and enter https://www.mydomain/Weatherforecast and I get a 404 error. I made sure that:
- In the IIS Application pool for this site I havce set .NET CLR Version to No Managed Code and Managed Pipeline mode to Integrated
- In the actual site in IIS I have set the persmissions correctly to the actual folder where the site is and made sure the https poret is configured to be allowed through the firewall
- I made sure I have installed the ASP NET Core Hosting bundle
- I have the following versions of .NET installed on the IIS server: Microsoft.AspNetCore.App 8.0.22 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 9.0.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 9.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 10.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 8.0.22 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 9.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 9.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 10.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 8.0.22 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 9.0.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 9.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
- I have the following .NET sdks installed 9.0.301 [C:\Program Files\dotnet\sdk] 9.0.308 [C:\Program Files\dotnet\sdk]
- I have configured the IIS site to have Failed Request Tracing set to all content for 404 errors and it does log the error it just does not tell me which file it is missing
- When I try to run this from a browser I get the following error page:
HTTP Error 404.0 - Not Found The resource you are looking for has been removed, had its name changed, or is temporarily unavailable. Most likely causes: The directory or file specified does not exist on the Web server. The URL contains a typographical error. A custom filter or module, such as URLScan, restricts access to the file. Things you can try: Create the content on the Web server. Review the browser URL. Create a tracing rule to track failed requests for this HTTP status code and see which module is calling SetStatus. For more information about creating a tracing rule for failed requests, click here. Detailed Error Information: Module IIS Web Core Notification MapRequestHandler Handler StaticFile Error Code 0x80070002 Requested URL https://MyDomain/WeatherForecast Physical Path D:\API\WeatherForecast Logon Method Anonymous Logon User Anonymous Request Tracing Directory C:\inetpub\logs\FailedReqLogFiles
- The server I am using is running Windows Server 2022 with all of the latest updates installed and am using IIS 10.0.20348.1
I am completely stumped here and have been for several days - any help would be much appreciated