WebMatrix provides a lightweight, integrated work
environment that allows us to run and tweak sites locally. After we’ve
finished customizing it, and have added some default content to the database,
we’ll want to publish it to a hosting provider so that others can access our
blog on the Internet.
WebMatrix includes built-in publishing support that makes it
easy to deploy Web sites and Web applications to remote hosters.
WebMatrix supports using both FTP and FTP/SSL as well as the Microsoft Web
Deploy (aka MSDeploy) infrastructure to easily deploy sites to both low-cost
shared hosting providers, as well as virtual dedicated/dedicated hosting providers.
To publish a site using WebMatrix, simply expand the
“Publish” icon within the top-level ribbon UI:
When we select the “Configure” option it will bring up the
following UI that allows us to configure where we want to deploy our site:
If you don’t already have a hosting provider,
you can click the “find web hosting” link at the top of the publish dialog to
bring up a list of available hosting providers to choose from:
Hosting providers are now offering Windows
hosting plans that include ASP.NET + SQL Server for as cheap as $3.50/month
(and these inexpensive offers include support for ASP.NET 4, ASP.NET MVC 2, Web
Deploy, URL Rewrite and other features).
The “find web hosting” link this week includes
a bunch of hosting providers who are also offering special free accounts that
you can use with WebMatrix – enabling you to try it out at no cost (they also
have everything setup to work well on the server-side with WebMatrix and are
testing their offers with the WebMatrix publishing tools).
Once you sign-up for a hosting provider, you
can then choose from a variety of ways to publish your site to it:
FTP and FTP/SSL enable you to easily publish
the local files of your site over to a remote server.
The “Web Deploy” option supports publishing
both your site files and the database content – and is the recommended
deployment option if your hoster supports it. When the “Web Deploy”
option is selected, WebMatrix will list all of the local databases within your
project and provide you with the option to specify the connection-string at the
remote hosting provider where your database should be deployed for production:
Note: By default BlogEngine.NET uses XML files
to store content and settings (and doesn’t require a database). With the
current BlogEngine.NET on the web gallery you can just enter
"Data Source=empty;database=empty;uid=empty;pwd=empty"
as the remote database connection string in order to publish the site without
needing to setup a database.
When you click “Publish”, WebMatrix will
display a preview of the deployment changes:
Note: because BlogEngine.NET doesn’t need a
database we’ll keep the database deployment checkbox unchecked. If we did
want to transfer a database we could select it in the publishing preview wizard
and WebMatrix will automatically transfer both the site files and the database
schema+data to the remote host, deploy the database to the hosting server, and
then update your published web.config connection-string to point to the
production location.
Once we click “continue” WebMatrix will start
the publishing process for our site, and after it completes our site will then
be live on the Internet. No extra steps are required.