I am trying to run a WebAPI project on WinXP through WebMatrix 2. I'm getting this error when attempting to browse index.cshtml (in the root):
"This type of page is not served."
I created a WebAPI project under the MVC4 project type in Visual Studio 2010, then set the project to run under IIS Express.
What I've Tried:
The .NET CLR settings in the VS-created WebMatrix site is .NET 4.0 (Integrated).
I've already tried playing with the runAllManagedModulesForAllRequests
setting in Web.config, no luck.
The error occurs in both the development server and IIS Express.
I have already rebooted.
However, if I create a Site through the WebMatrix2 UI, it works. Razor .cshtml files added to that site through WebMatrix render just fine.
TIA!
SUCCESS!
The problem was a single line in the default WebAPI template web.config:
Setting that
webpages:Enabled
setting totrue
fixed the problem and now my .cshtml files work. Hope this helps others.This question explains the
webpages:Enabled
setting: what is the function of webpages:Enabled in MVC 3 web.config