If you are getting error message below with a simple .cshtml file after you published your MVC3/MVC4 to the server
Server Error in '/' Application.
This type of page is not served.
Description: The type of page you have requested is not served because it has been explicitly forbidden. The extension '.cshtml' may be incorrect. Please review the URL below and make sure that it is spelled correctly.
Requested URL: /index.cshtml
That is because you are trying to directly access a Razor page outside of the ~/Views folder while in ASP.NET MVC 4 this is disabled by default. In order to enable it all you have to do is adjust the following setting in your web.config:
<
appSettings
>
<
add
key
=
"webpages:Enabled"
value
=
"true"
/>
</
appSettings
>