InfoWorld preview: WebMatrix ramps up ASP.Net development
Microsoft combines all-in-one installation, a gallery of templates, and coding shortcuts to speed dev and deployment of Windows-based websites
Inline Razor code makes it easy to instantiate a database object, define a query, issue the query against the database, and iterate through the results for display on the webpage. (Or you can use that data grid helper mentioned earlier.) If SQL Compact gets too cramped, WebMatrix provides a migration tool for moving a Compact database to Microsoft SQL Server or SQL Server Express. All you need are the connection strings for the destination database; the migration tool replicates the schemas in the target and copies the data over.
Finally, WebMatrix also automates website publication. Not only can WebMatrix transfer your website's folder structure and files to your target server, it will also deploy your site's database. In addition, it produces an audit of the deployment for verification that all the pieces arrived at their destination.
WebMatrix publishes your site using one of two protocols: Web Deploy or FTP. Web Deploy is more automated, but only works with hosting providers that recognize it. Web Deploy also has the advantage of being able to deploy SQL Server or SQL Server Express databases; you enter the connection string and user access information for the target database, and Web Deploy will transfer tables and table content from your production server to the target. It also handles the chore of changing connection strings in your application from the production URLs to deployment URLs.
Meanwhile, FTP deployment is exactly what you'd imagine: It transfers files wholesale. While FTP transfer will work with any target site supporting FTP, it cannot deploy SQL Server or Express databases (though it has no problem with an SQL Server Compact database, which is just a file). And some of the behind-the-scenes work that Web Deploy does for you must be executed manually with FTP transfer.
WebMatrix haves and have nots
Microsoft's WebMatrix website makes the following claim: "WebMatrix lets you code, test, and deploy both ASP.Net and PHP applications side by side." Well, yes and no. You can certainly code ASP.Net and PHP applications in WebMatrix -- in the same way that you can code applications in Notepad. Although the IDE does provide syntax highlighting, it has neither IntelliSense nor code-completion for any of the ASP.Net languages (Razor, C#, VB.Net) or for PHP.
WebMatrix does do a fine job of installing PHP-based websites from the site gallery, as I learned by installing the well-known phpBB bulletin-board system. WebMatrix found all the dependencies (I needed PHP for IIS, as well as SQL Express for the database), downloaded them, and built the correct folder structure. I was up and running in minutes.
As for testing applications, it's not pretty. WebMatrix has no debugger. There are a couple of helper objects -- ServerInfo and ObjectInfo -- that you can use to view important environment information and the data type and content of an object. But these are really nothing more than "debug by print" mechanisms. WebMatrix also has a Requests tool that captures the HTTP request/response traffic to your website. But the displayed information is severely abridged. You are not shown the raw data of the exchange, nor does WebMatrix display the HTTP headers, so this feature is only worthwhile for identifying which HTTP requests produced errors. If you have the excellent free Fiddler Web debugger installed, you'll never use WebMatrix's requests feature.