Scott Forsyth's Blog

Postings on IIS, ASP.NET, SQL Server, Webfarms and general system admin.

Cloud Resources

IIS Resources

Configuring IIS6 for WebMatrix

The news of WebMatrix was just released, causing a lot of interest in the tech community.  See Scott Guthrie’s blog post for details on WebMatrix, IIS Express, SQL Server Compact and the Razor syntax.

The nice thing about all of these technologies is that they use managed code and are xcopyable, even to a web host that isn’t fully prepared for it.  Even the SQL Server CE engine is xcopyable.  However, at Orcsweb, we’ve been working hard to make the deployment story for WebMatrix extra easy under the name of Cytanium, an Orcsweb venture.  We offer free accounts for testing WebMatrix publishing.

I had someone ask me today about setting up their site on an IIS6 server.  Turns out that it’s very straight forward.  I haven’t tested a lot of scenarios yet to see if there are other settings that I missed, but so far everything looks good.

Configuring IIS 6.0 for WebMatrix and MVC

WebMatrix uses .cshtml and .vbhtml as the file extensions, it is also uses the new extensionless routing engine, plus many of the current apps that you’ll find in the Web Platform Installer (WebPI) use MVC or other extensionless methods.  Therefore, the easy solution is to add ASP.NET as the wildcard handler.

Note that if you add a wildcard handler, default docs won’t work for traditional webforms apps unless you specifically handle them.  So, just add wildcard handlers to your WebMatrix folders.

To add a wildcard handler, fire up IIS Manager, navigate to the folder that you want to add the wildcard mapping, right-click and click Properties.

Then you need to get the path to the framework version.  My favorite way to do that is to pick an existing extension, like .asax (right up at the top) and edit it.  Copy the path from the “Executable” field into your clipboard.  It will be something like this:

.NET 2 C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll
.NET 2 x64 C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll
.NET 4 C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll
.NET 4 x64 C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll

Cancel out of that dialog box once you have the path in your clipboard.

In the Wildcard section of the Application Configuration, insert the extension and uncheck the “Verify that file exists” checkbox.

image

Save out.  That’s it!

Everything else will be the same as with IIS 7.x.  The next challenges to watch for that that may come up will likely be related to the framework version, whether everything was correctly deployed, database connection strings, and whether sites in subfolders are marked as applications. 

Hope you enjoy the WebMatrix testing and deployments!

Posted: Jul 08 2010, 07:42 PM by OWScott | with 11 comment(s)
Filed under: ,

Comments

Dave said:

Scott, what do you think of WebMatrix so far?  (This was the project we couldn't talk about when you were visiting last time.)

Dave

# July 13, 2010 2:26 PM

OWScott said:

Hi Dave,

Now I can piece it together finally. :)  Yes, love it.  I think that all parts of the stack meet an important need.  The IDE, razor, IIS Express and SQL CE are all key technologies.  They play a key role and I think will be well accepted.

# July 18, 2010 4:09 PM

erik5388 said:

Hey,

I am getting it to work, but... only when I add ".cshtml" to the end of every page

# August 26, 2010 2:48 PM

OWScott said:

Erik, if you added the wildcard extensions, then it's probably something in the routing that isn't set up.

It's possible that this post may help: forums.iis.net/.../1950774.aspx.  Follow the link to another post with good detail on extensionless routing.

# August 26, 2010 3:03 PM

Nick said:

Great one! I found a problem with passing arguments to urls, though - you must pass websiteurl/details.cshtml/2  instead of websiteurl/details/2

# January 4, 2012 1:24 PM

OWScott said:

Hi Nick,

Thanks for the update!  The .cshtml extension will work but you should also be able to get extensionless URLs working in IIS6.  Here are two sites with further troubleshooting steps on how to tackle that:

- haacked.com/.../asp-net-mvc-3-extensionless-urls-on-iis-6.aspx

- www.microsoft.com/.../webmatrix-10-release-notes

# January 5, 2012 9:26 AM

ayanmesut said:

I cannot set the configuration correctly. I cannot find the following place?

To add a wildcard handler, fire up IIS Manager, navigate to the folder that you want to add the wildcard mapping, right-click and click Properties.

'navigate to the folder' ???

I am using windows 7..

# November 14, 2012 1:03 AM

OWScott said:

Hi Ayanmesut,

This is only needed for IIS6. If you're using IIS7, especially with the app pool set to integrated mode, then it should work out of the box. Or at least the IIS portion should.

The installer for WebMatrix should take care of everything in IIS7.  What type of errors do you see?

# November 17, 2012 10:58 PM

Marianne said:

Thanx!!! I am new to razor and I could not figure out where I went wrong - now it works like a charm, thanks again for this useful post!

# December 28, 2012 9:03 AM

George said:

I have been using VS 2003 which now does not run in win 7.

What is the best move using WebMatrix or VS Express?

# August 6, 2013 9:21 AM

OWScott said:

Hi George,

That really depends on your situation. I would recommend trying both and seeing which makes the most sense to you. I would go with VS Express personally because I prefer that environment, but WebMatrix is a great tool for certain types of development and I would recommend it to some people too.

# August 8, 2013 11:56 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)