Windows 2008r2 – WebMatrix on IIS7

Migrating WebMatrix 3.0 to a Windows 2008r2 / IIS 7 combination is a different story than the 2003 / IIS 6 version.

Before you start it is best that you make sure all files and folders are straight below the main ROOT folder of your IIS. (WebMatrix Razor code does not like applications in subfolders !! Gives you a lot of headaches.)

1. Make Sure you first install DotNET 4.0 to use WebMatrix 3.0 on a Windows 2008r2 server.

2. Check that you have the .NET and ISAPI Filter and Extensions installed for the IIS role.


After the installation, run these commands, to register the ASP.NET 4.0 for IIS : This step is not needed for IIS 8

x64 -> %windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -ir

x86 -> %windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe –ir


And check the results in the Application Pool if ASP.NET is there.


Don’t forget to set the ASP.NET v4.0 Application pool to run x32 bit apps.


And check the setting Managed Pipeline Mode is set to INTEGRATED

3. Create a Virtual Directory to host your application.

Next right click the Folder and select Convert to Application.


This is important.

The settings inside the main web.config will otherwise cascade downwards. And all other config files will inherit the main site settings.

If they have settings of their own they will override the parent. Which is the case in your WebMatrix Razor Application !

4. Link the Application folder to the ASP.NET v4.0 Application Pool.


5. Test your application now.

Getting Errors ? See here for some obvious mistakes :

If needed, Adjust the variable paths, in the pages to point to your new Virtual directory on IIS.

Make use of the “~/” dynamic pointer. And add to each URL in the pages, the extension .cshtml in the code.

Test the SQLCE database connection. It you get an error like this :

Access to the database file is not allowed. [ 1914,File name = C:\Inetpub\wwwroot\App_Data\test.sdf,SeCreateFile ]

Check the permission on the folder ~\App_Data\ where the .sdf file resides, and change it the read/write.

Test the External Database connections if you have them as well. If you get errors, you need to check the Web.Config to see if you have the correct data source settings in there.

When you see this Error in “/” Application.


You might want to add the missing MIME settings for .cshtml



Success !

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: