WebMatrix 2 Beta - Using IIS Remote Manager to Enhance Your Site
If your web hosting provider uses is an IIS shared hosting provider chances are you can use IIS Manager for Remote Administration to additionally configure your site. This post will walk you through a simple WebMatrix publish example, connect to the remote site with IIS Manager, modify a remote setting and sync the changes back to WebMatrix.
First Time Publishing and Extracting Data
Depending on your web hosting provider, you may have received an email with connection information or a publish settings XML file containing remote connection credentials. You can use this information to publish your site to the live server. To connect to your remote site through IIS Manager with your publishing credentials you’ll need the server name, user name, password and remote site name. If you are using a publish settings XML file, you can open the settings using Notepad to extract the password.
Connecting With IIS Manager
First launch IIS Manager by typing “inetmgr” in the Start – Run utility or by launching it from the start menu group. If you have installed IIS Manager for Remote Administration onto a machine that is capable of running IIS, the Run utility is your only option.
Next, click “Connect to Site…” in the Start Page for IIS Manager.
Using the information you collected above, follow the wizard to connect to your site. You can give your connection a friendly name once you’ve completed this step.
If your hosting provider has additional utilities installed on the remote server, you will be prompted to download them.
Configuring Additional Server Settings Through IIS Manager
Now that you’re connected to your site, there are various addition IIS settings available to configure. It important to note that this list will be different between web hosting providers, depending on the features that they’ve delegated to their users.
In this example, I’m going to quickly add a custom HTTP Response Header.
Once I’ve made this configuration change, the server writes this value to my application’s web.config. As noted earlier, you can configure a number of server features depending on how much the hosting provider has delegated.
Keeping IIS Express/WebMatrix In Sync With Server Changes
One of the key advantages of using WebMatrix is the ability to keep in sync with remote site changes. In the previous step, we modified a remote server setting which was saved to the site’s web.config file. Going back to WebMatrix, I’m going to open my published site’s Remote Tab and click “Sync Remote to Local”. This will pull down any files that are different from the remote site.
You will get a quick preview of the changes that have occurred and an option to continue or change the list. If you check the “Delete files on my computer that are not on the remote server” box, you run the risk of accidentally deleting files that might not have been published before.
Once you’ve pulled back the changes from the remote site, navigate to the Files Workspace and open up the web.config file. The changes that were made on the server are now represented in your local development environment.
Summary
This is one easy way to keep your remote server and your local development environment relatively in sync while you make server specific changes. Most of the time, changes that you make on the remote server using IIS Manager will be written to the site’s web.config file. If you pull the settings back down to WebMatrix/IIS Express, you can ensure that the local test environment will behave similar to the live environment.