Setting up a Host server for VS2010 web publishing

by Michael Wolski 21. February 2010 11:47

Visual Studio 2010 (VS2010) has some wonderfully integrated features for building and deploying web sites. The VS team has finally made it easy to get your web site onto someone else's Host server. But what if you want to implement a Host server and allow developers/customers easy access to your server? How do you do it?  You have questions, we have answers.

Note: You may also want to check out our companion article titled: Setting up a Host server for VS2010 web publishing.

In Visual Studio 2010 (and in VS2008 as a separate download), the web developer can quickly deploy the website by using the Publish Web  feature. To publish a web, generally the developer would create a Configuration, add in the proper web.config transforms for his server-specific settings, right-click on the web project, and select Publish. The resulting dialog looks something like the one presented below. But what does the server need to support in order to allow web publishing from Visual Studio? 

Enter the Web Deploy Tool

To accept web publishing your server must be running IIS and have installed the Web Deploy tool 1.1 or later. The Web Deploy tool is supported on both 32-bit and 64-bit servers and is pretty simple to install.

  1. If you haven't done so already, install the Microsoft Web  Platform installer. This application makes installing IIS modules (like the Web Deploy tool) a snap!
  2. Install the Web Deploy tool appropriate for your server (32-bit or 64-bit).
  3. More installation instructions can be found here.
  4. Once installed the only "gotcha" that you may hit is that the Web Deployment Agent Service is not immediately started. To start this service Please do the following:
    • On the server, click Start | Run
    • Type in services and hit enter.
    • Search for Web Deployment Agent Service
    • Right-click on the service and select Properties
    • Change the Start-up Type to Automatic (or Automatic delayed start)
    • Click the Start button on the dialog to start the service immediately
    • Click OK to save your changes.

Configuring a Website for Publishing

In order to allow a user to publish to a website, a couple items need configuration. This includes setting up the website and the user(s) that will be allowed to publish to the site.  

Setting up the website

Setting up the website in IIS7 works the exact same way as normal. Run IIS Manager and create a new website. As always, make sure the Application Pool account has access rights to the website directory.

Setting up the users

The next step involves making sure the users have access to the website directory.  The user accounts are Windows accounts, and they will need read/write privileges to the actual website directory. In windows explorer, navigate to the website directory and make sure the appropriate users have permissions.

Publishing to the Server

Once the website is setup and the users have been given permission, you are now ready to Publish to your website. 

  1. To publish, run VS2010, right-click the web project in Solution Explorer, and select the Publish menu option. 
  2. From this dialog, you will want to pick the Web Deploy publish method. 
  3. The Service URL will be the default website URL for your server (Ex: http://myserver.com). 
  4. The site/application value is simply the name of your website as seen in IIS manager.
  5. Make sure  you enter the user name/password of the user account on the host server that has permissions to publish to the site.

That is it! Once setup properly, Publishing to the website is a breeze.

Tags:

Visual Studio