Wednesday, August 28, 2013

Web Deploy in Visual Studio 2012


Visual Studio 2012 has new feature where you can deploy your web projects to your production or development server in one click. following are the steps to follow.

Step 1:

Right click on the web project & select publish.


Step 2:

Then you will get the following window where we have to configure the deployment settings.


There are two ways we can create profiles.

  1. Import profile from already created publishsettings file.
  2. Create a new profile.

In here I will explain how to create a new profile.

Step 3:

In the Select or import a publish profile drop-down list, choose <New …>, and enter a name for the profile in the New Profile dialog box.




Step 4:

After that you will get the following window where you have to set up the connection on the deployment.


  •  Publish method  

If you select Web Deploy and you are publishing to IIS on your own computer for testing, you must have administrative rights on your computer, and Visual Studio must be running in administrator mode. (To open Visual Studio in administrator mode, right-click the Visual Studio icon in the Windows Start menu and select Run as Administrator.)

If you select Web Deploy and you are publishing to a server on your own network, make sure that the server is set up for the Web Deployment Agent Service (MSDepSvc, also known as Remote Agent service), and that you have administrative rights on the destination server. For information about how to set up the destination server,

If you are deploying to a hosting provider that does not support Web Deploy, you can select FTP instead.

Besides Web Deploy and FTP, another option is to use the File System publish method. This method publishes the web application to a folder that you specify. You can then use your own FTP tool to transfer the files to a hosting provider.

One of the Publish method options is Web Deploy Package. If you want to create a deployment package, then you can copy the package the destination server & then import that package directly to the IIS.


  •  Service URL

enter the URL that Web Deploy can use to publish the application.

If you are publishing to a hosting company, the company provides this value. It can be in any of the following formats:

  1. HostingCompanyURL (for example,

  2. https://HostingCompanyURL (for example,

  3. https://HostingCompanyURL:8172/msdeploy.axd (for example,

If you are publishing to IIS on your own computer for testing, enter localhost or the name of your computer.

If you are publishing to a server on your own network, enter one of the following URLs:

  1. http://ServerName

  2. http://ServerName/msdeployagentservice

If you’re publishing through a firewall, you might need to open port 8172.


  • Site/application

enter the name of the IIS web site and application.

  • User Name & Password

enter credentials for an account that has sufficient authority to perform deployment tasks on the destination web server

Then you can validate you settings by clicking on the Validate button in the window.

Step 5:

Next step is to configure the settings tab.


  • Configuration.

select the configuration setting which you want to publish in the deployment.

  • File Publish Options

expand the file publish options in the window then you will get following three options to select.


Remove additional files at destination

Will delete the files in the destination folder on deployment.

Precompile during publishing

Precompile or merge assemblies when you package or publish the project. when you click on this option you can click on configure then it will give the following advanced option where you can configure as per your requirement.


Exclude files from the App_Data folder

Prevents files in the App_Data folder from being deployed to the destination server

Step 6:

Then click next then you can preview the changes.

Step 7:

Then click on publish so that the site will be published.

Following these steps you can create a web deploy profile. Then next time when you want to publish that project the profile you creates will be loaded you have to just select the profile & click publish , visual studio will take care of the deployment.



Happy Deploy !!!!!

No comments :

Post a Comment