There are two approaches to the Deploy website on IIS.
Approach 1: Web Deployment Package from VS2010
1.jpg
Approach 2: Publish Option from VS2010
2.jpg
Approach 1: Web Deployment Package
In VS2010 you can create a web Deployment Package which you can import from IIS to deploy your web application. Follow these steps to accomplish this:
1, Right-click you asp.net web application project and select "package/Publish Setting".
3.jpg
2, Provide a few basic data in the configuration form (you may not want to change any setting in the first attempt). Select the project and click on properties.
4.jpg
3, Right-click on the project and select "Build Deployment Package". Visual Studio will build the deployment package (zip file) and will store it in the default location.
5.jpg
4, Open IIS manager(type "inetmgr" in Run command), Right-click on the target web site (where you want to deploy your Asp.net application), Select deploy=>Import application
6.jpg
Important Note
If your IIS doesn't have this Deploy option then you need to install Extension of the IIS.
So that visits this web site:
http://www.iis.net/downloads/microsoft/web-deploy Click on Install this Extension
install that extension and you will get this message.
install-Extension-of-the-IIS.jpg
Then will be able to see the deploy option in IIS.
5, Browse the deployment package file (the Zip file) to select it and select "Next" buttons on wizard steps and click the "finish" button on the last step. You can alter the connection string in wizards steps.
7.jpg
6, Now Browse your website from the IIS.
Approach 2: Publish option from VS2010
You need to create a simple website in iis, but careful about Application Pool version if your application version is less than 4.0 then the Pool version should be 2.0.
Then from VS2010 Right-click on application and select publish Option
8.jpg
A form will appear where you need to provide some basic information (The target hostname and Site/Application name). Provide this two information and (Along with, check the checkbox "Mark as IIS application on destination") click on the "Publish" button to publish the web application.
9.jpg
Service URL: Localhost
Site/Application: Name of Website which you have created in IIS/folder name in which you have store application data for the website.
Select option Mark as IIS application on destination.
Click on Publish.
Important notes
Enable the directory Browsing.
Example:
<add name="ConnectionString" connectionString="Data Source=Servername;Initial Catalog=databaseName;User ID=Userid;Password=password;Integrated Security=false" providerName="System.Data.SqlClient" />