How to run ASP.NET MVC app in IIS 10 on Windows 10

2020-04-02 08:12发布

问题:

I installed IIS 10 through windows features and published MVC app into the IIS folder, then executed "dism /online /enable-feature /featurename:IIS-ASPNET45" command but still getting error:

HTTP Error 403.14 - Forbidden The Web server is configured to not list the contents of this directory

I've done this in windows 7 with "aspnet_regiis -I" command instead of "dism /online /enable-feature /featurename:IIS-ASPNET45" and web app loaded just fine from localhost, but I can't seem to get this to work on Windows 10.

回答1:

I had the same problem and I solved it by using the Win10 GUI for selecting installed features. Internet Information Services -> World Wide Web Service -> Application Development Features->ASP.NET 4.6 was not checked. Checked that along with a few others I needed and all was good.



回答2:

I had similar problem - in my case IIS just have not full rights to access folder where I put website files...

Giving full access to directory via Windows Properties/Security resolved problem in my case.

Try put your website files to C:\inetpub - form my experience it's the best location (but should make no difference).

Other things: - check if IIs have rights to C:\inetpub & ..\Documents\IISExpress - check if you have installed right version od .NET and ASP.NET

I see that you try install ASP.NET 4.5, but what targeting your project?

If you trying deploy new project you probably need APS.NET 4.6 or ASP.NET 5 RC (in second case you need also setup DNX).