How to Install and Configure Web Deployment on IIS 7.x

 1 – Introduction

When using Internet Information Services (IIS) Web Deployment Tool (Web Deploy) 2.0 or later, there are three main approaches to get packaged web applications onto a web server:
·         Deploy the application from a remote location by targeting the Web Deployment Agent Service (also known as the "remote agent") on the destination server.
·         Deploy the application from a remote location by targeting the IIS Web Deploy Handler on the destination server.
·         Deploy the application from a remote location using Web Deploy On Demand (also known as the "temp agent").
First two methods are covered in the present document.

Web Deployment Tool (Web Deploy 3.0)

https://www.microsoft.com/en-in/download/details.aspx?id=30436


2 –  Prerequisites

1. .NET Framework 2.0 SP1 or greater installed

clip_image002

2. IIS 7.x role installed on the target server with basic website/web application configured

3. Install Web Management Service (WMSVC) role on the Web server

Start Server Manager
clip_image004

Click on Add Role Services link
clip_image006

Click Next to continue
clip_image008


Click Install to proceed with the installation
clip_image010


Wait until the role gets installed and click Close button
clip_image012


4. Install the Web Deployment tool on the Web server

Locate and open the folder containing the installer file, right click on the installer and click on Install
clip_image014


Click Next
clip_image016 

Accept the License Agreement terms and hit Next
clip_image018 

Click on Complete
clip_image020


Click on Install button
clip_image022

Wait until the installation process completed
clip_image024

Click Finish button to complete the installation
clip_image026

3 –  Enable IIS Remote Connections

Open IIS Manager snap-in
clip_image028

Select the Server node and in Features View of the Server double-click the Management Service icon in Management section
clip_image030

Select Enable remote connections checkbox is selected. If the not selected and greyed out, use the Actions pane to stop the WMSvc Service. This will let you select the checkbox. Click Start
clip_image032

Click Yes to save the setting
clip_image034

Make sure the service is Started
clip_image036

4 – Configure Web Deployment Agent Service

1. To use Web Deploy Remote Agent Service add Windows user’s account to Local Administrators group on the Web server

 

2. Permit a Windows user to manage a Web site or an application remotely

 

In IIS Manager expand sites, select Web site name, in Features View double-click the IIS Manager Permissions icon

clip_image038

 

On the IIS Manager Permissions page in the Actions pane, click Allow User

clip_image040In the Allow User dialog box, select Windows as user type then click Select

clip_image042

 

On the Select User or Group dialog box, type a user name and then click OK





Click OK to dismiss the Allow User dialog box

 













Configure ACLs for the physical directory of a Web site with read, write, execute permissions for the Windows user ID. Add the user if needed
clip_image048

Select Security tab, click Edit and then Add on next window
clip_image050
clip_image052

Click Localtions button, on next window select domain and hit OK 
Type in user ID in the dialog box and click OK
Select checkboxes needed to configure permissions for the Web site directory and click OK

 3. Test the configuration in IIS Manager


Open IIS Manager snap-in and click File and then click Connect to a Site (or Connect to an Application)

clip_image062

 

On the Connect to Site or Connect to Application wizard type the server name and the site name to connect to. If connecting to an application, type the application name also. Click Next

clip_image064

 

Enter Windows user’s credentials and click Next

clip_image066


Provide Web site or application name and click Finish

clip_image068


Make sure the Web site name appeared in IIS Manager Connections pane

clip_image070

5 – Configure IIS Web Deploy Handler

1. To use the Web Deploy Handler create and configure IIS Manager user to connect to a site or an application

In IIS Manager select Server node and in Features View double-click the IIS Manager Users icon
clip_image072

On the IIS Manager Users page in the Actions pane click Add User

clip_image074





Choose and type a user name and password, and then click OK
clip_image076

To permit an IIS Manager user to connect to a site or an application select Web site name and in Features View double-click the IIS Manager Permissions icon
clip_image077

On the IIS Manager Permissions page in the Actions pane click Allow User

clip_image078

In the Allow User dialog box select IIS Manager as user type then click Select

clip_image080

In the Users dialog box select the user name created then click OK

clip_image082

Configure ACLs for the physical directory of a site or an application with read, write, and execute permissions for IIS users who need to connect to that site or application. Right click on Web site folder and select Properties
clip_image084



Select Security tab, click Edit and then Add on next window
clip_image085
clip_image086

Click on Locations button and on next choose local server name and click OK 

Click on Advanced button and on next type in  LOCAL SERVICE as u user name and click OK
clip_image092
clip_image094


Give the account under which WMSvc is running LOCAL SERVICE Full Control permissions to the users's directory. Click OK twice
clip_image096
clip_image098


2. Create Delegation Rules for Web Deploy functionality (providers)

 

The following rules must be created accordingly: Deploy Applications with Content Rule, Mark Folders as Applications Rule, Deploy Databases Rule, Set Permissions Rule

To allow a user to deploy applications and content to his or her Web site open IIS Manager, select the Server node and in Features View of the Server, double-click the Management Service Delegation icon.
clip_image100


If contentPath and iisApp providers do not exist in the list create the rule by clicking Add Rule in the right-hand Actions pane
clip_image102

Select the Deploy Applications with Content rule template. This template creates a rule that allows any WMSVC authorized user to use the Web Deploy contentPath and iisApp providers to deploy applications to user’s scope.
clip_image104

Click OK to open the template then click OK to create the rule as needed
In the Add User to Rule dialog box, type an asterisk (*). This will allow each user to deploy applications to his user scope

If the providers configured expand it and make sure the asterisk (*) is selected as the user name allowed to deploy
clip_image106



To allow each user to create an application within his Web site make sure if createApp rule set and (*) is selected as the user name allowed to create applications
clip_image108

3. Test the configuration in IIS Manager


Open IIS Manager snap-in and click File and then click Connect to a Site (or Connect to an Application)

clip_image110

 

On the Connect to Site or Connect to Application wizard type the server name and the site name to connect to. If connecting to an application, type the application name also. Click Next

clip_image111

Enter IIS Manager user’s credentials and click Next

clip_image113

Provide Web site or application name and click Finish

clip_image114

Make sure the Web site name appeared in IIS Manager Connections pane

clip_image116


Create a quick application package to verify that the authorization rules are working. Right click on Web site or application name, go to Deploy menu and select Export Application
clip_image118


In Export Application Package wizard click Next through all of the screens to accept the defaults
clip_image120

clip_image122

clip_image124

Click Finish to create a package
clip_image126

With the package created, verify that it is installable:
a. In the
Actions pane, click Import Application
b. Click Next
c. On the Parameters
page, change the application name to something that doesn’t already exist in the Web site to verify that the user can create applications
d. Complete the wizard

 

4. Test the configuration in Visual Studio


Open/create test web application in Visual Studio on local desktop or laptop. For example:
clip_image128


Publish the web application either using web server IP, hostname or FQDN
clip_image130



In the Publish Web dialog window enter Service URL as shown, select Allow untrusted certificate if no certificate installed on IIS server which issued by official CA, and enter IIS Manager user’s credentials, click Publish button
clip_image132

Deployment Output information should be similar to:

------ Build started: Project: WebApplication1, Configuration: Debug Any CPU ------
  WebApplication1 -> C:\Documents and Settings\rrakhim\my documents\visual studio 2010\Projects\WebApplication1\WebApplication1\bin\WebApplication1.dll
------ Publish started: Project: WebApplication1, Configuration: Debug Any CPU ------
Transformed Web.config using Web.Debug.config into obj\Debug\TransformWebConfig\transformed\Web.config.
Auto ConnectionString Transformed Account\Web.config into obj\Debug\CSAutoParameterize\transformed\Account\Web.config.
Auto ConnectionString Transformed obj\Debug\TransformWebConfig\transformed\Web.config into obj\Debug\CSAutoParameterize\transformed\Web.config.
Copying all files to temporary location below for package/publish:
obj\Debug\Package\PackageTmp.
Start Web Deploy Publish the Application/package to https://10.193.57.93:8172/MsDeploy.axd?site=dailyliquiditytest ...
Adding child dirPath (dailyliquiditytest\Account).
Adding child dirPath (dailyliquiditytest\bin).
Adding child dirPath (dailyliquiditytest\Scripts).
Adding child dirPath (dailyliquiditytest\Styles).
Updating setAcl (dailyliquiditytest).
Updating setAcl (dailyliquiditytest).
Adding child filePath (dailyliquiditytest\About.aspx).
Adding child filePath (dailyliquiditytest\Account\ChangePassword.aspx).
Adding child filePath (dailyliquiditytest\Account\ChangePasswordSuccess.aspx).
Adding child filePath (dailyliquiditytest\Account\Login.aspx).
Adding child filePath (dailyliquiditytest\Account\Register.aspx).
Adding child filePath (dailyliquiditytest\Account\Web.config).
Adding child filePath (dailyliquiditytest\bin\WebApplication1.dll).
Adding child filePath (dailyliquiditytest\bin\WebApplication1.pdb).
Adding child filePath (dailyliquiditytest\Default.aspx).
Adding child filePath (dailyliquiditytest\Global.asax).
Adding child filePath (dailyliquiditytest\Scripts\jquery-1.4.1-vsdoc.js).
Adding child filePath (dailyliquiditytest\Scripts\jquery-1.4.1.js).
Adding child filePath (dailyliquiditytest\Scripts\jquery-1.4.1.min.js).
Adding child filePath (dailyliquiditytest\Site.Master).
Adding child filePath (dailyliquiditytest\Styles\Site.css).
Adding child filePath (dailyliquiditytest\Web.config).
Updating setAcl (dailyliquiditytest).
Updating setAcl (dailyliquiditytest).
Publish is successfully deployed.
========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
========== Publish: 1 succeeded, 0 failed, 0 skipped ==========

Test the webpage deployed (http://10.193.57.93/default.aspx):

clip_image134


Post a Comment

Previous Post Next Post