Introduction :
Visual Studio 2005 IDE provides us some useful way to deploy our web sites on Web Server (IIS). Maximum times we are going to deploy our application by creating Virtual Directory on IIS and this is the best way to deploy . But some times we need to do deploy our applications directly from VS also. Visual Studio includes features that integrate with IIS and allow us to create Virtual Directories with in Visual Studio IDE.
Visual Studio Provides Three Important Features to deploy our web sites
- Creating virtual directory at the time of creating new web project
- Using Copy Web Tool
- Publishing web site
Creating Virtual Directory At The Time Of Creating New Web Project :
From Visual Studio when we are create a web sites simultaneously create a virtual directory for that web sites. In General case we create a web sites in our local system and Visual Studio used it own built in web server to run that application. But if we want do so , Visual Studio won't use its Built-in web server to deploy the sites rather that a Request will send to IIS and then IIS will taking care of it. Now Let See, How to do so.
Steps:
- Visual Studio > File > New Web Sites
In that Screen , Select HTTP in Location Field instead of File System (By Default) . Now Just Write the URL for that application ,as given in picture. Visual Studio will create a Virtual Directory on IIS with named "mydemosites" . Now If that Virtual Directory already exists , It will not create it, it will just use the existing one.
2. Click on OK. Check the Solution path . its is in local host
Visual Studio Does nor provide limited number of functionality of IIS Manager. We can create a Virtual Directory with existing application.
Step :
-
Click on Browse Button of New Window [ shown in First Image ]
-
Select Default Web Sites
3. Click On Create Virtual Directory, Give Alias name and Folder Path
Now, This approach has certain limitation,
Limitation :
-
If Development and production environment is same then all the changes in your application directly affected to live environment which is not at all preferable.
-
Virtual Directory will be created at the time of Starting of you application. We don't have any option to create virtual directory in that way for an existing application.
-
Application Location should be C:/inetpub/wwwroot, which some times not preferable to manages all other resources of your application.
-
We can't configure other settings like , Authentication Settings, Default Pages, Custom Errors etc
Using Copy Web Tool :
Visual Studio also provide another useful control transfer our web application files directly from Visual Studio.
Steps:
1. Your Web Sites > Right Click > Copy Web Site.
2. Click on Copy Web Site... Following Screen will come
In copy web tool , There are two window, one is current location, which is our local solution file and another id remote site that is our target location. First of all we have to set the target server , to enable the area. For that we need to click on Connect
Now , a new window will come , using which we can specify location for remote web site
-
File System: Remote location will be the local system or may be network folder, it will just create a new folder to store the application.
-
Local IIS : Create Virtual Directory on IIS under default web sites. we can also create new virtual directory as shown earlier.
-
FTP Site : It is used for FTP site, we need to configure FTP for that
-
Remote Site: We have to specify the remote sites URL for copying the file
After , Specify the Location , we will have the enabled Remote Server Section and enabled button to copy files.
Publishing web site :
This features gives us to deploying our application to a production server and keep the source code secure Visual Studio Publishing Features use aspnet_complier command line utility to secure our code. it will just publish the sites with compiling that code. we just need to deploy the it on IIS server. There are only a few steps.
Steps :
-
Right Click on Web Site > Publish Web Site
2. Set the location for your publishing, you can directly Deploy to IIS or the set location as earlier that already discussed., Check the allow this precompiled site to updateable, this will help you to change effects on client site code on you live site with out recompile.e.g, suppose you need to change a alert message , for that just change on client code and it will reflected on live sites , for that you do not need to recompile
This are three approaches provide by the VS2005. Hope You enjoyed the article.
Point of Interest:
This are some quite interesting approches to deploy our application in IIS through Visual Studio
Reference:
Copy Web Tool MSDN
Publish Web Site MSDN
History:
Written on Sunday, Octbor 19, 2008