Just setup a new Windows 2022 Server with IIS 10 and .NET 4.8. Default Web Site works.
I created a new site from a VS Template - an empty ASP.NET MVC C# web app. It contains Index, About and Contact views with no database for now.
The project publishes successfully using MS Deploy, but I am seeing the following:
Server Error
403 - Forbidden: Access is denied.
You do not have permission to view this directory or page using the credentials that you supplied.
My first thought was folder permissions since I am using C:\Sites
for the physical path instead of C:\Inetpub\wwwroot
, but I also receive the same error publishing an ASP.NET MVC app to the Default Web Site.
There are no warnings or errors in Windows Event Viewer. The IIS Site log shows:
2022-07-24 10:56:46 172.nnn.nnn.nnn GET / - 80 - 173.nnn.nnn.nnn Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/103.0.0.0+Safari/537.36 - 403 14 0 88
I'm thinking that the 403 is being thrown because IIS is looking through its list of Default Documents and not finding one - but this is an MVC app with Controllers and Views. I don't think the web application is being detected by IIS as an MVC app.
I've also enabled Directory Listing and this sure enough skips the error message and shows me a listing of the site's root folder. Of course, this isn't a fix.
Does anyone have a clue why this might be happening - or how I can find details to troubleshoot it? It just seems that the web app isn't being detected as an ASP.NET MVC application. :S