This topic explains how to deploy a Web application project by using one-click publish and the Web Deploy publish method. One-click publish with the Web Deploy publish method enables you to automate most tasks that are required in order to deploy a Web application.

To use these features, Web Deploy must be installed on your development computer and the same version of Web Deploy must be installed on the destination Web server. (By default, Web Deploy is installed on the development computer when you install Visual Studio.) If you are deploying to a third-party hosting company, the company must support the version of ASP.NET that your Web application targets and must support one-click publish. For information about how to use one-click publish with other publish methods, see How to: Deploy a Web Application Project Using One-Click Publish Without Web Deploy.

Deploying a Web application project using one-click publish might involve the following additional tasks that are not described in this procedure:

- Specifying database deployment options. If the Web project that you want to deploy uses a database, and if scripts must run during deployment in order to set up database structures or data in the destination environment, you must enter settings in the Package/Publish SQL tab of the project Properties page.

- Specifying Web.config file transformations. Web.config files typically include settings that have to be different depending on which environment the application is running in. For example, the Web.config file on your development computer might enable debugging, but you typically do not want debugging enabled for an application that runs on a production server. You can create transform files that automate the process of changing Web.config settings during deployment.

Specifying Files and Settings to Deploy

You use the Package/Publish Web tab of the project Properties page to configure settings that determine what files should be included when the Web application is deployed. The default settings on this tab will work for many typical scenarios. You can skip this procedure if all the following conditions are true:

- You want to deploy only the files that are required in order to run the site. For example, this might be true if source code files are compiled into assemblies, and you want to copy only the assemblies to the destination server.

- You do not have to replicate IIS settings from the source computer to the destination server. For example, this might be true if the project to deploy is a local IIS Web project and you have set up error-handling rules for its IIS application, but you do not have to replicate those rules on the destination server. If the project to deploy is a file system Web project, there are no IIS settings to replicate.

To specify files and settings to deploy


1. In Solution Explorer, right-click the project name and then click Properties.

2. Click the Package/Publish Web tab.

3. In the Configuration list, select the build configuration that you want to configure deployment settings for.

You can configure deployment for the Debug orRelease build configurations, or for a custom build configuration that you have created by using the Configuration Manager dialog box. For example, you might want different settings for deploying to a test server and for deploying to a production server.

The default value for the Configuration is Active, which means that the settings on this tab apply to the build configuration that is currently selected for the project. The currently selected build configuration is shown in the main toolbar and in the Configuration Manager dialog box. (To open Configuration Manager, select it from the Build menu.)

4. Select one of the following options from the Items to deploy (applies to all deployment methods) drop-down list:

- Only files needed to run this application. Files that are not required in order to run the site are not deployed to the destination server, such as code files that are compiled into assemblies.

- All files in this project. All files included in the project are deployed to the destination server. Files that are in the project folder but are not included in the project are excluded.

- All files in this project folder. All files in the project folder are deployed to the destination server, even if they are excluded from the project.

5. If you expect that you will never want to enable debugging on the destination server, select the Exclude generated debug symbols check box.

Clearing this option causes .pdb files to be deployed to the destination server. These files are required for debugging. You typically do not want .pdb files on a production server, but you might want them on a test server.

6. If you have files in the App_Data folder and you do not want them to be deployed to the destination server, select the Exclude files from the App_Data folder check box.

For example, you might have a SQL Server Express .mdf file in the App_Data folder during development. However, you plan to deploy the database by using automatically generated scripts on the production server. In that case, you would select this option when you deploy to the production server because there is no use for the .mdf file on the production server.

7. If you want to run database scripts that are specified in the Package/Publish SQL tab during deployment, select the Include all databases configured in Package/Publish SQL tab check box. (The Package/Publish SQL tab is described in a procedure later in this topic.)

A typical scenario is to run scripts that configure databases only the first time a Web application is deployed. When you deploy updates to a Web application, you typically do not have to deploy updates to the database.

8. If the Web project that you are deploying is an IIS Web project, and if you want to propagate the project's IIS settings to the destination environment, select the Include all IIS settings as configured in IIS Manager check box.

IIS settings specify options such as authentication methods and how the Web application responds to errors. If you are deploying to a server on your company's network, you might want to configure the destination server the same as the development server when you deploy to a test server, but not when you deploy to a production server. If you are deploying to a hosting company, the account that you use for deployment typically will not have the administrative permissions that are required in order to make changes to IIS settings. In that case, do not select this option.

If the current Web project is not an IIS Web project, this option and the option for application pool settings are disabled.

9. If you selected the Include all IIS settings as configured in IIS Manager option, and if you want application pool settings from the Web project to be duplicated in the destination environment, select the Include application pool settings used by this Web project check box.

Creating a Publish Profile

Before you can publish the Web application, you must create a publish profile that specifies how to publish. You can create multiple profiles that have different settings. Before you click the Publish button, you can select the profile that has the settings that you want to use. The publish profile settings apply to the active build configuration (for example, Debug or Release). The following procedure explains how to create a profile.

To create a publish profile

1. In the Build menu, click Publish projectname.

2. In the Publish profile box, enter a name for the new profile.

3. In the Publish method drop-down list, select Web Deploy.

4. Enter a value for Service URL.

If you are publishing to the development computer (that is, to your computer), enter localhost or the name of your computer. You must have administrative rights on your computer.

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

http://ServerName

http://ServerName/msdeployagentservice

The destination server must be set up for the Web Deployment Agent Service (MSDepSvc, also known as Remote Agent service), and you must have administrative rights on the destination server.

If you are publishing to a hosting company, the required value will be provided by the company. The value can be entered in one of the following formats:

- https://HostingCompanyURL:8172/msdeploy.axd (for example, https://contoso.com:8172/msdeploy.axd)

- https://HostingCompanyURL (for example, https://contoso.com)

- HostingCompanyURL (for example, contoso.com)

The hosting company must set up the destination server for the Web Management service (WMSvc, also known as Web Management Service, which is used with the Web Deployment Handler). This method is typically used by hosting companies, but it can also be used on your internal company network. If you use this method, you do not have to have administrative rights on the destination server.

5. Enter a value for Site/application.

If you are publishing to the development computer or to a server on your company's network, enter the site and application name as they appear in IIS Manager. For example, if you are publishing to the default Web site and if the application name is MyApplication, enter Default Web Site/MyApplication.

If you are publishing to a hosting company, the required value will be provided by the company. The value will typically be either a domain name (for example, contoso.com) or a domain and application name (for example, contoso.com/MyApplication)

6. If you are not deploying IIS settings, select the Mark as IIS application on destination check box.

This option is not shown if you are deploying IIS settings, because the Web project's IIS application status is one of the IIS settings that is deployed.

You typically select this check box when the Include all IIS settings as configured in IIS Manager check box on the Package/Publish Web tab of the project Properties page is cleared. There are very few scenarios in which you would not want to deploy a Web project as an IIS application on the destination Web server. For example, suppose that the project that you are deploying is not actually a Web application but only contains virtual directory content, such as images, XML files, and so forth. In that case, you might want to clear this check box so that the deployed project is not set up as an IIS application.

7. If you want one-click publish to delete files on the destination server that have no matching files in the Web project, clear the Leave extra files on destination check box.

The publish process deletes files on the destination server under the following circumstances:

- You clear the Leave extra files on destination option.

- The files already exist on the destination server in the publish location or in any subfolders.

- The same files do not exist in the same folders in the Web application project.

8. If you are publishing to a hosting company and the hosting company advises you to allow untrusted certificates, select the Allow untrusted certificate check box.

9. In the User name and Password boxes, enter credentials for an account that has sufficient authority to perform deployment tasks on the destination Web server.

If you are publishing to a hosting company, this information will be supplied by the hosting company.

10. Click the Save button to save the profile.

Publishing the Web Application

One-click publish is designed to make it easy to deploy a Web application and to update the application after it has been deployed. After the initial deployment, when you click the Publish button, Visual Studio determines what has changed in the Web site and deploys only the changes to the destination server.

To publish the Web application

In the Publish Web dialog box or in the Web One-Click Publish toolbar, click the Publish button.

The first time that you click the Publish button, Visual Studio and Web Deploy perform all the tasks that are required in order to set up the Web project on the destination server. If you click the Publish button again, only changes are deployed. For example, suppose that your site has 100 Web pages and you add one Web page. When you click Publish again, only the new Web page is copied to the destination server.

What is so SPECIAL on ASPHostDirectory.com ASP. Net 4 Hosting?

We know that finding a cheap, reliable web host is not a simple task so we’ve put all the information you need in one place to help you make your decision. At ASPHostDirectory, we pride ourselves in our commitment to our customers and want to make sure they have all the details they need before making that big decision.

We will work tirelessly to provide a refreshing and friendly level of customer service. We believe in creativity, innovation, and a competitive spirit in all that we do. We are sound, honest company who feels that business is more than just the bottom line. We consider every business opportunity a chance to engage and interact with our customers and our community. Neither our clients nor our employees are a commodity. They are part of our family.

The followings are the top 10 reasons you should trust your online business and hosting needs to us:

- FREE domain for Life - ASPHostDirectory gives you your own free domain name for life with our Professional Hosting Plan and 3 free domains with any of Reseller Hosting Plan! There’s no need to panic about renewing your domain as ASPHostDirectory will automatically do this for you to ensure you never lose the all important identity of your site
- 99,9% Uptime Guarantee - ASPHostDirectory promises it’s customers 99.9% network uptime! We are so concerned about uptime that we set up our own company to monitor people’s uptime for them called ASPHostDirectory Uptime
- 24/7-based Support - We never fall asleep and we run a service that is opening 24/7 a year. Even everyone is on holiday during Easter or Christmast/New Year, we are always behind our desk serving our customers
- Customer Tailored Support - if you compare our hosting plans to others you will see that we are offering a much better deal in every aspect; performance, disk quotas, bandwidth allocation, databases, security, control panel features, e-mail services, real-time stats, and service
- Money Back Guarantee - ASPHostDirectory offers a ‘no questions asked’ money back guarantee with all our plans for any cancellations made within the first 30 days of ordering. Our cancellation policy is very simple - if you cancel your account within 30 days of first signing up we will provide you with a full refund
- Experts in ASP. Net 4 Hosting
- Given the scale of our environment, we have recruited and developed some of the best talent in the hosting technology that you are using. Our team is strong because of the experience and talents of the individuals who make up ASPHostDirectory
- Daily Backup Service - We realise that your website is very important to your business and hence, we never ever forget to create a daily backup. Your database and website are backup every night into a permanent remote tape drive to ensure that they are always safe and secure. The backup is always ready and available anytime you need it
- Easy Site Administration - With our powerful control panel, you can always administer most of your site features easily without even needing to contact for our Support Team. Additionally, you can also install more than 100 FREE applications directly via our Control  Panel in 1 minute!

Happy Hosting!