MVC3 error message: .cshtml The type of page you h

2019-08-21 11:27发布

问题:

I have deployed mvc3 application in IIS 7

It is running as integrated .net 4 mode. Can anyone please guide?

Error message is: The type of page you have requested is not served because it has been explicitly forbidden

回答1:

Things to check:

  • If IIS was installed after .NET 4.0 on the server you need to run aspnet_regiis.exe to register it with IIS
  • The application pool is set to run in integrated mode
  • In your web.config you have the <modules runAllManagedModulesForAllRequests="true"/> set
  • You are accessing your site with http://server/home/index (change the controller and action names to match yours).
  • You have a route that will match the {controller}/{action} url in your Global.asax.
  • The corresponding view exists in ~/Views/Home/Index.cshtml.