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?


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:

  <modules runAllManagedModulesForAllRequests="true"/>

This solves everything :)

| improve this answer | |

I don't know much about Razor (or MVC in general, I'm no developer) but what I do know is that you can push the code to your IIS without having MVC installed on the server (best as I can tell, Razor code is supposed to have MVC3 installed on the server). Unless I misunderstood your question, you should be able to follow the steps in the link above, and get your site working.

| improve this answer | |
  • I already deployed the bin dll's using the publishing-function in WebMatrix. I think the problem lays in that I can't even see my .cshtml files from the webbrowser. It just says "The requested document was not found on this server." – Behrens Feb 24 '12 at 16:59
  • You may need to check permissions on the folder the site is hosted in IF you have the site sitting somewhere other than c:\inetpub\wwwroot – JohnThePro Feb 24 '12 at 17:03
  • Even if fx index.htm can be seen with no problems? – Behrens Feb 24 '12 at 17:10
  • So, the browser can see the file index.htm in the directory, but it cannot see a .cshtml file in the same directory? – JohnThePro Feb 24 '12 at 17:11
  • That is correct – Behrens Feb 24 '12 at 17:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.