Extensionless URLs do not find .cshtml/.vbhtml files on IIS 7 or IIS 7.5

June 18, 2011 at 8:21 PM

Issue: Extensionless URLs do not find .cshtml/.vbhtml files on IIS 7 or IIS 7.5

On IIS 7 or IIS 7.5, requests with a URL like the following are not able to find pages that have the .cshtml or .vbhtml extension:

http://www.example.com/ExampleSite/ExampleFile

The issue arises because URL rewriting is not enabled by default for IIS 7 or IIS 7.5. The likeliest scenario is that you do not see the problem when testing locally using IIS Express, but you experience it when you deploy your website to a hosting website.

Workaround

<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>

Issue: Using WAP or MVC and ASP.NET Web pages in the same application

If you were using ASP.NET Web Pages in a WAP or MVC application, you might see an error that WebPageHttpApplication can not be found.

Posted in: MVP | Technical Stuff

Tags: ,