Scott Hanselman

Microsoft WebMatrix in Context and Deploying Your First Site

July 07, 2010 Comment on this post [30] Posted in ASP.NET | ASP.NET MVC | IIS | Learning .NET | WebMatrix
Sponsored By

 ScottGu announced Microsoft WebMatrix Beta today.

  • WebMatrix Starting PageIt's a small (15 megs if you have .NET 4, 50megs if you don't) lightweight IDE for making ASP.NET or PHP websites.
  • It has a small embedded file-based SQL Database, and a web-server called IIS Express that's compatible with the full version of IIS.
  • It uses a View Engine called "Razor" to make Web Pages, and your sites can be later be expanded to use all of ASP.NET MVC. It's a simple syntax that is easy to learn
  • It uses the WebDeploy engine to deploy apps to hosts, setting up permissions, copying databases, etc.
  • WebMatrix also has the Search Engine Optimization Toolkit built in, so you can spider your own site and see how Search Engines see it. It'll make recommendations and store reports.

I've said before that Microsoft is just now starting to get the "right-sized LEGO pieces." It the past some stuff was too little or too big, but now as an example, here's five separate and right-sized LEGOs (ya, I know it's singular) that are helpful for the professional and the folks just getting starter, or those who don't want to learn a bunch of stuff to setup and/or modify a website.

Visual Studio 2010 looks like a dashboard. It's big and powerful and overwhelming. I tried to get my wife, then later my 10 year old nephew to make a website and it was a non-starter. It worked later with WebMatrix. This isn't for professionals, even though it has components that professionals will use. Pros will like a free file-based SQL Server, and a non-service version of IIS that's more compatible than the Visual Web Developer, and pros might like using Razor as an alternative View Engine for their ASP.NET MVC sites.

However, folks that are starting out, or hobbyists, or maybe just installing a blog or forum will use WebMatrix to get stuff done.

Download and Install Matrix

Here's how you'd get WebMatrix, sign up for a new host, and deploy your first site.

Go to the WebMatrix site and click Download Now. It'll install the Web Platform Install (about 2 megs) and then you click Install. The WebMatrix download for me was 8megs, then SQL Compact was 2.5megs, and then some deployment dependencies brought my total download to 29 megs.

Run and Select a Site

You can install a site from the Gallery, like ScottGu did when he chose BlogEngine.NET. These are regular ASP.NET and PHP apps that you've probably used before. There's lots of Open Source apps like Blogs (like DasBlog, that runs this site!), Content Management Systems (like Umbraco, that powers!) and other apps that you can start working with immediately.

However, since we're learning, my wife and I are going to select Site from Template and pick the Bakery App. This is a basic store-type application that we can deploy in just a few minutes. We don't need to look at code if we don't want to.

WebMatrix Site from Template

Hit OK and I'm in WebMatrix looking a new screen.


At this point I can click Run to see my app.


It's running locally on IIS Express along with some others Apps I was looking at earlier. This is effectively FULL IIS (not Visual Web Developer) but installed as a User App...when I stop the app, it's gone. It's not an auto-startup service, but it is IIS, which means your apps will run the same locally as they do deployed.


I can run it locally, but how do I get it up to a host?

Deploying My App to a Host

Things usually get complicated when you go to deploy and app. It's pretty easy to get an application running locally, but it's sometimes a challenge to get that app up on a site. People can sign up for a Gmail or Hotmail account and get that running, so why can't they get a website up that they coded themselves?

I've blogged about WebDeployment before and shown examples in my Mix Video "If you're using XCopy you're doing it wrong." WebDeploy is part of WebMatrix also.

I'll click on Publish and "Find Web Hosting" and I get a list of hosts I can choose from. I'll select Applied Innovations and click Learn More. I do prefer hosts like AdHost that give you both a .NET 2 and .NET 4 Application Pools to work in, which means I can use apps from the Gallery and apps that use the new Razor Syntax at the same time.

I go to Applied Innovations, and fill out the form. I'll get free hosting until next year with 1 GB of Disk Space and 100 GB monthly transfer. I get .NET 3.5 and 4, but also PHP. I can use SQL Compact, but also mySQL.

I fill out a form -  no credit card needed - and they send me an email. Click a link and they send me back an email with all the details I need. This is the same experience you'll get with all the hosters.

My Opinion: Some hosts make you switch your AppPools between .NET 2 and .NET 4 and that's too hard for beginners, I think. Hopefully all the hosters will remove this step and offer two app pools, or make switching between them a top level button in their Control Panels. AdHost does this. I hope others will also.

To switch to .NET 4, go to the Control Panel URL in your welcome email. Click WebSites, Extensions and select ASP.NET 4 from the dropdown.

Control Panel

Other hosts to choose from during this Beta are:

I fill out the Publish Form in WebMatrix with the details direct from my new host.


Notice I don't need to do anything special for my database, as it's a file-based SQL database, runs in Medium Trust and requires no configuration.

Click Publish, and I'll get a list of files that'll be copied up. This is a differential copy, so if you change one file later, only that file will go up. Be sure to click the checkbox to deploy your database.

Publishing Preview

The publish happens in the background...

Publish Progress Bar

Then it completes, and I can now visit my new Bakery site online at my host, AppliedI:


Of course, if I wanted to, I could change the site, maybe modify the Products page:

LayoutPage = "~/_Layout.cshtml";
PageData["Title"] = "Product";

var db = Database.Open("bakery");

<h2>Available Products:</h2>
<div class="products group">
@foreach (var p in db.Query("SELECT * FROM PRODUCTS")) {
<div class="product">
<img src="@Href("~/Images/"+ p.ImageName)" alt="@p.Name"/>
<ul class="group">
<li class="price">$@string.Format("{0:f}", p.Price)</li>
<li class="order">
<form action="Order" method="post">
<input type="hidden" name="ProductId" value="@p.Id"/>
<input type="submit" value="Order Now"/>

There's lots of nice helpers for Google Analytics and Twitter integration:

<div class="sidebar">
@Twitter.Search("#bakery", caption: "#bakery")
I could of course, also edit my data:

Database Editing in WebMatrix

All in a reasonably not scary-dashboard looking UI. It's all ASP.NET underneath, so I can graduate to ASP.NET MVC and move my logic into controllers, and I've already got Views written in the "Razor" syntax, which is the new default for ASP.NET MVC 3.


If you're reading this blog, and you're not my Wife, this tool probably isn't for you. (Hi, wife.)

However, the pieces that make up WebMatrix probably are. SQL Compact is pretty sweet. It's small, free, file-based and easy to upgrade to SQL Express Big Boys and Girls Edition. The new Razor syntax is a nice alternative to the WebForms Syntax (as are other alternative ViewEngines). IIS Express is hotness, especially if you've ever had an app that acted differently on IIS than on Visual Web Developer.

If you are learning web development or just want to get a site up, check out WebMatrix. Even if you don't edit the code, you can get and deploy and app to a host quickly, be it an ASP.NET app or a PHP app. If you do choose to write an app yourself, you can get started with WebMatrix and then move to Visual Studio (Free Express or $ Pro) if you outgrow it.

I'll report back and see what the WAF (Wife Acceptance Factor) is on WebMatrix.

Related Links

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service
July 07, 2010 1:31
Scott, is Razor available outside of WebMatrix at this time?
July 07, 2010 1:37
"If you're reading this blog, and you're not my Wife, this tool probably isn't for you."

So why post about it? You're going to get no end of snark from experienced developers.

(I'd be interested to hear more about the strategic role this is supposed to play, personally.)
July 07, 2010 1:44
Razor available outside: Yes and no. If you run Web Platform Installer 3.0, you can see "ASP.NET Pages" which is the Razor syntax, but NOT integrated directly into ASP.NET MVC. The MVC part is coming soon, but not today.

Why post about it? My wife, nephew, Dad might want to look at it. You might want to look at it for the Normals in your life. I guest lecture at Universities and Colleges, and I might want to show them this as well. I speak on blogging and setting up your own blog, as well as to kind-of-techie business owners who want to manage their own CMS, etc. For those folks.
July 07, 2010 1:51
Actually Scott you get free hosting until 12/31/2010, not just a measly 2 months!

That's great feedback on the App Pools too. Initially we had them deployed as .NET 4.0 Integrated but because so many of the applications in the Web Application Gallery are .NET 3.5 and not .NET 4.0, we opted for .NET 3.5 instead of 4.0 as the default. Hopefully, we'll see an automatic way to manage this in Web Deploy in the future so it will be even more user friendly.

BTW, WebMatrix is great for deploying PHP & MySQL applications too. I have a screenshot heavy walkthrough of how I published a wordpress site and the mysql database all thanks to you webmatrix on

July 07, 2010 5:11

I doubt many non-developers are going to have a clue on how to build and even understand what you just wrote!

How about putting effort into Visual Studio support for Iron Ruby on Rails ?

Actually my wife uses an iMac. Can we get a MacOS version? :)
July 07, 2010 5:43
Scott, I have a couple questions:

1) Does Razor have a dependency on .NET 4? (wondering as many hosters still only offer .NET 3.5 for shared hosting)

2) Does WebMatrix provide a way to check IIS consistency between local (IIS Express) and host provider? Wondering if there is a way to detect differences in IIS modules installed (e.g. IIS URL Rewrite, or Dynamic Image Resize Modules.).

July 07, 2010 7:24
Hi Scott,

I think this is the great tool for developing web applications. Does this application support creating new web application/site as the original WebMatrix (for 1.1) using webforms?

July 07, 2010 7:50
Pravesh - The templates that come with WebMatrix all make MVC/Razor Sites, but you can open any existing 2.0 or above ASP.NET WebSites or Applications and develop on them. However, at that point, you need to consider if you've outgrown this tool. It's lightweight. It's not Visual Studio.
July 07, 2010 8:43
Scott, Thanks for the clarification.
July 07, 2010 11:52
Scott - Your blog's been broken in IE 7 for a week now -

Internet Explorer cannot open the Internet site

Operation aborted

It works fine in Firefox though.
July 07, 2010 12:32
Hey Anonymous, it's more helpful for me to debug if you leave your name and email. ;) I'm not seeing this, and you're the first person in a week to mention it. Could you clear your cache? Any add-ins? What about Ctrl-F5?
July 07, 2010 13:02
I'll e-mail you my details. I get this JS error first.
Cache is cleared.
Add-ins wise, just standard IE Developer stuff. IE Dev Toolbar and Fiddler.
Flash, Adobe Acrobat too.

A Runtime Error has occurred.
Do you wish to Debug?
Line: 306
Error: Object expected
Yes No
Then the operation aborted message.
A Runtime Error has occurred.
Do you wish to Debug?

Line: 0
Error: Object doesn't support this property or method
Yes No
July 07, 2010 13:55
I checked the sample code at Scott Gu's blog and was surprised to find database access code sitting right next to HTML :-O

I am reading this blog. I am not your wife. => This tool is not for me. I get it. A simpler tool then VS 2010 is a great idea, but simple for whom? The creators of WebMatrix?

Considering the target audience, it is natural to presume they are not terribly aware of programming practices needed to create good, and at the very least "maintainable" application. I would want a tool like WebMatix to have a lot of CONSTRAINTS, almost FORCING them to write good code. There should be no way to write the code shown in the blog by Scott Gu.

For me, the only developers who would be capable of creating "good" applications with this tool are "professional" developers who want a quick solution.
July 07, 2010 14:55
the Normals in your life

Scott, do you really feel that the normals in your life need a software tool? Do they express interest in developing or do they want a website? If it's the latter, go to or

I think Web Matrix is strictly a tool for those that want to develop (students and interns mostly). In my experience, the normals as you call them have zero interest in developing. Just like I have zero interest in doing surgery on people, working on legal documents or analyzing rocks and soil (which are all some of the jobs in my family).
July 07, 2010 15:21
Microsoft invents PHP. Now one can create his own mess of ASP.NET, SQL & HTML.
July 07, 2010 17:41
Is there a way to get/use the file-based SQL out of there too?

I've used SQLite, but if this is something that's more 'actual' SQL Server I'd even happier...
July 07, 2010 20:44
I can't find any documentation on how to configure VS2010 to use IIS Express to run sites (other than Scott Gu's blog that says it can be done). Can you help?
I've downloaded WebMatrix, and run it, but it will only run as long as you're running a site. VS still only gives you the same options for running your site.
July 07, 2010 21:27
Is Visual Studio 2010 required to run WebMatrix?
July 08, 2010 0:09
Scott, Will webmatrix have intellisense? I downloaded webmatrix last night and was quite surprised when I hit "." and nothing happened. (It kinda scared to me to realize how much I depend on it).

Razor is pretty cool. I love the syntax and I can't wait to try it out with mvc.
July 08, 2010 3:13

Would love to hear what you really think of this project\product.


"WebMatrix is NOT end user friendly!! Titanic fail. Next! Suggestions needed for EASY s/w for website dev, for NON techies pls!"

Not my words, the words of I assume people like her are the target audience?
July 09, 2010 17:23
How easily can the webmatrix projects be moved from one machine to another? I get asked occasionally to help someone setup their website. I don't mind helping them get started. But I don't want to be responsible for making every little update they have forever.

So, can I create the initial stuff for them to get started on my own machine and then give them all the necessary files so they can update the project on their own machine? (except for the webmatrix toolkit itself, obviously)
July 09, 2010 19:52
You can just copy files from directory to directory. You can do it just bin-deployed if you want.
July 12, 2010 15:26
I relly liked the new web matrix but i think it need two things to become more popular. the first one is is should be avaliable in at least 50 languages my friends here in brasil have a seriously dificult in reading every thing that is not in portuguese. I think if you are a developer there is no way to don't learn english and be a good professional, but this tool is not only for professional developers so a lot of people that are not so good in english sould be able to operate this as well. the orther thing is intelessence this thing is a most expecially for people that are not so familiar with the programing sintax.

July 13, 2010 11:43
Wasn't the free version of VWD called Web Matrix before the Express program? It's good to see an old friend come back. My daughter (7) was asking me to make a website for her. I told her, that I'll teach her how to make a website instead. I think this might be just the tool I need. For the time being, the site will only be visible on my intranet. But hopefully, it will help her find a creative spark. I don't want to force her down the path of tech...but I do want to encourage any interest and foster it that she shows.
July 14, 2010 11:23
hi, Microsoft WebMatrix is free?Performance?
July 14, 2010 13:12
Yes, it's free, and it's all ASP.NET so its performance is no different than regular ASP.NET.
July 19, 2010 13:05
It's great! I find many host that support .net 4.0 long time.
July 27, 2010 20:47
Even experienced developers get value of out this. The WebPI plus WebMatrix has already proven to be a simple way to experiment with the web apps in the web gallery. Now I can see how I might want to integrate some of this community work instead of just thinking about it.

While I don't expect to spend my days in WebMatrix, it has already made for an incredible fast prototype tool that I think will just be more invaluable.
August 20, 2010 19:32
What's the current story on WebMatrix? Is there a blog or a site that tells what's happening with the product and when MS expects to ship a new version? I like this little tool, but the current version is almost unusable because of its extremely limited IDE. I'd really like to see this thing fleshed out with a real IDE, including intellisense. Without intellisense, at least, the "normals" will never be able to really use it.
January 17, 2011 8:47
I just used WebMatrix for the first time (and then found this blog article). I'm impressed from a few standpoints and then there are a few things that could be added and then I would incorporate it into regular usage.

The Good:

1.) It's fast. It starts fast. It loads pages fast. The IDE looks nice and is simple. It's built in Visual Studio button makes it easy to open the project in VS.

2.) The ability to easily setup and configure prebuilt open source solutions. This is an extremely useful feature and has a lot of potential in terms of finding good open source projects and then getting them easily setup.

3.) The Razor syntax. Enough said.

What it needs for me to really want to use it daily:

1.) Intellisense. This is the #1 feature I rely the most on. I can start VS for the object browser, I can start VS for any other bell/whistle that I might need (or run them side by side)... but for this IDE to be highly useful, it needs intellisense (CSS/HTML/C#/VB). If this editor adds Intellisense support, I may very well use it daily alongside Visual Studio (it gives me the best of both worlds then).

2.) Basic support for code behinds without having to manually add the code. MS has made a big push into the MVC model but there are a lot of us who are still living in a WebForms world due to organizational politics and probably won't be changing anytime soon.

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.