Setting Server 2008R2 up for ASP.NET with Razor

asp.netiis-7.5installationwindows-server-2008-r2

I have created a webpage with WebMatrix on my laptop running Windows 7 and IIS7. WebMatrix automatically set up IIS7 so that it can run ASP.NET 4.0 and I haven't done anything further than that.

I'm now trying to set up my Windows Server 2008 R2 with IIS7.5 for ASP.NET WebPages using C# with Razor-code. For this I have installed ASP.NET 4.0 and set the application pool to ASP.NET 4.0.

The site can easily be published with WebMatrix, but WebMatrix can't check compatibility and when trying to access a .cshtml file, it can't be found.

What do I do?

Best Answer

I just read through http://www.microsoft.com/web/post/webmatrix-and-aspnet-web-pages-release-docs, and found that the following must be in the Web.config file:

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

This solves everything :)