Microsoft WebMatrix in Context and Deploying Your First Site
ScottGu announced Microsoft WebMatrix Beta today.
- It'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 http://asp.net!) 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.
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.
Other hosts to choose from during this Beta are:
- Cytanium from Orcsweb (disclosure: my blog is hosted at Orcsweb)
- AppliedInnovations
- GoGrid - Cloud-based
- AdHost - Gives you .NET 2 and .NET 4 AppPools
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.
The publish happens in the background...
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">
<h3>@p.Name</h3>
<img src="@Href("~/Images/"+ p.ImageName)" alt="@p.Name"/>
<p>@p.Description</p>
<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"/>
</form>
</li>
<ul>
</div>
}
</div>
There's lots of nice helpers for Google Analytics and Twitter integration:
<div class="sidebar">I could of course, also edit my data:
@Twitter.Search("#bakery", caption: "#bakery")
</div>
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.
Context
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
- Channel 9 Video: WebMatrix with Scott Hunter and Simon Calvert
- Learn by Doing - WebMatrix walkthroughs
- 1 - Getting Started
- 2 - Coding with Razor Syntax
- 3 - Creating a Consistent Look
- 4 - Working with Forms
- 5 - Working with Data
- 6 - Working with Files
- 7 - Working with Images
- 8 - Working with Video
- 9 - Adding Email to your Website
- 10 - Adding Social Networking
- 11 - Analyzing Traffic on your Website
- 12 - Adding Caching for Faster Websites
- 13 - Adding Security and Membership
- 14 - Introduction to Debugging
- 15 - Customizing Site-Wide Behavior
- ASP.NET Web Pages API Reference
- WebMatrix Tutorials and FAQs
- File a Bug on WebMatrix or Suggest a Feature
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.
About Newsletter
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.)
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.
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 http://jesscoburn.com/
Thanks,
Jess
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? :)
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.).
Thanks,
--Brian
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 asp.net 1.1) using webforms?
Thanks,
Pravesh
Internet Explorer cannot open the Internet site http://www.hanselman.com/blog/.
Operation aborted
It works fine in Firefox though.
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.
Then
---------------------------
Error
---------------------------
A Runtime Error has occurred.
Do you wish to Debug?
Line: 0
Error: Object doesn't support this property or method
---------------------------
Yes No
---------------------------
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.
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 Wordpress.com or Blogger.com
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).
I've used SQLite, but if this is something that's more 'actual' SQL Server I'd even happier...
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.
Razor is pretty cool. I love the syntax and I can't wait to try it out with asp.net mvc.
Would love to hear what you really think of this project\product.
N.B
"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 http://twitter.com/VeroniquePalmer. I assume people like her are the target audience?
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)
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.
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.
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.