Monday, February 02, 2009

Web Deployment with VS 2010 and IIS

Today, deploying a web application is not as easy as it should be. Whether you are deploying your web to a shared hosting environment and paying monthly to maintain it OR whether you have a web server/s managed by your enterprise, there are a lot of manual steps involved in getting your application from point A to point B.

If you are deploying your web application to a shared hoster then today you have to use technologies like FTP which take a long time to get your web content to the hosted server. After deploying your content you have to manually go to hoster control panel and install your database by running sql scripts and configure various IIS settings like marking a folder as an application to isolate it from the rest of the application.

If you are in an enterprise environment and you want to get a web application deployed you have to systematically document each step that your server admins and DBAs have to perform. In most circumstances you also have to ask your admins to modify the web.config files and go to IIS Manager and configure your settings apart from deploying your web content. Your DBA has to do the necessary steps of running the sql scripts in the right order to get your DB up and running. Such installations many a times take hours to complete.

With Visual Studio 2010 and IIS Web Deployment Tool (MsDeploy.exe / Web Deploy) we are introducing a set of technologies which can seamlessly deploy your applications taking care of the problems stated above. Microsoft Web Deployment Tool is a free download available on the web… You can download MSDeploy from below location:

Do note that installing Visual Studio 2010 will automatically install MSDeploy for you. Visual Studio 2010 CTP can be downloaded from below location:

Web Deployment feature sets in VS 2010 can be broken down into following major areas:

1. Web Packaging - VS 2010 uses MSDeploy to create a .zip file for your application which we call as a web package. This file contains meta data + the below artifacts

· All of your IIS Settings (e.g. application pools, error pages etc)

· Web Content (e.g. .aspx, .ascx, .js, images etc)

· SQL Server DB

· Various other artifacts like Security Certs, GAC Components, Registry etc

A web package can then be taken to any server and installed either via IIS Manager UI Wizard or even via command line or API for automated deployment scenarios.

2. Web.Config Transformation – With VS 2010 web deployment we are introducing XML Document Transform (XDT) which will allow you to transform your development time web.config file to production/deployment time web.config file. The transformation is controlled by web.config TRANSFORM files named web.debug.config, web.release.config etc. The naming of these files is tied to the MSBuild configuration you are trying to deploy. The transform file will need just the changes that you really want to make to your deployed web.config… You can control the type of changes by instructing the XDT engine using simple and easy to understand syntax…

e.g. the below syntax in web.release.config will replace the connectionString section with new values in the web.config file which is produced for deployment of your release configuration.


3. DB Deployment – VS 2010 allows you to deploy your application along with all of its dependencies including database dependencies on SQL Server. Just by providing the connection string of your source database VS10 will automatically script its data/schema and package it for deployment. VS will also allow you to provide custom .sql scripts and also sequence them correctly to run on the server. Once your DB is packaged along with your IIS Settings and web content you can choose to deploy it to any server by providing the connection string at the install time.

4. 1-Click Publish - VS 2010 will allow you to not only package your web applications with all of its dependencies but also use IIS remote management service to publish the application to remote server. VS 10 will now allow you to create a publish profile of your hoster account or of various testing servers and save your credentials securely so that going forward you can deploy to any of these publish profiles with just one click using Web One Click toolbar. With VS 10 you will also be able to publish using MsBuild command line so that you can configure your team build environment to include publishing in continuous integration model.

To learn in further details about these technologies please view the videos here.



Anonymous said...

Internet Information Services (IIS) - formerly called Internet Information Server - is a set of Internet-based services for servers created by Microsoft for use with Microsoft Windows. It is the world's second most popular web server in terms of overall websites behind the industry leader Apache HTTP Server.

Unknown said...

IIS is a very wonderful service provided by Microsoft for windows users
San Francisco Website Design

Brian said...

XDT certainly will be useful to some, but those of us that have a knowledge investment in XSLT or XQuery are going to be very frustrated that there isn't direct support for those languages.

Sure, for most trivial apps, XDT will produce smaller code (at least than XSLT/XPath 1.0), but size shouldn't be the primary determining factor, or we'd all be programming APL.NET or IronPerl.

Shouldn't there be choice of transform language for developers, just as with GP progamming languages? After all, Microsoft isn't killing VB anytime soon, are they?

I suspect the biggest part of the problem is the lack of an XSLT/XPath 2.0 processor in .NET.

Gdeep said...

Microsoft Has taken its next big after launching VS2010 in the field of webdevelopment and deployment.

Anonymous said...

I am using Visual Studio 2010 Release candidate1. I have to deploy my web application which consists of a website, certain window services, certain WCF services and Sql Server 2005 database.

I want to know how to deploy Window Services and WCF services using Web Package.

Also, I want to create a web setup (.msi) for deployment instead of Web Package so that the .msi takes care of all the application and database deployment like the web package does.

Anonymous said...

Brian, XDT does have functions that support both inline xpath and external xslt files for making your transforms. I dont see how not having an xslt 2.0 processer has anything to do with it.

free meta tag generator said...

Good post. I am bookmarking your blog.. This free meta tag generator tools provides the easy way of generating title and meta tags for seo onpage optimization. free meta tag generator

PeteW said...

Back when ASP.NET V1 was released, one of the selling features was simple XCOPY deployment. I was sold and I'm sticking to it.

Justhost said...

Im glad to see that people are actually writing about this issue in such a smart way, showing us all different sides to it.

Anonymous said...

its very helpful.Thank you very much

Unknown said...

Hi,its an excellent method for Web Deployment with Visual Studio 2010.Thanks for you help...