Exercise 11: Deploying the Web Application

In this exercise, you will deploy the Routing we application project using Windows Server AppFabric; a set of extensions to the Windows Application Server and the Windows Process Activation Service (WAS). The goal of Windows Server AppFabric is to simplify the deployment, configuration, management, and monitoring of Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) services built on .NET 4.

Note:
Is AppFabric installed?

AppFabric is not installed as a part of the .NET Framework 4 installation. It comes as a separate install delivered through a Windows Update package for Windows that you can download from https://go.microsoft.com/fwlink/?LinkID=169435

To determine if AppFabric is installed open IIS Manager. If AppFabric is installed when you open the Default Web Site you will see AppFabric at the top of the features window.

Task 0 – Opening the Solution

To begin this exercise you can use the solution you finished from Exercise 10. Alternatively, you can follow the following steps to begin with Exercise 11.

  1. Open the starting solution for Exercise 11 located under the Source\Ex11-DeployWebApplication\Begin(choosing the folder that matches the language of your preference.) Use it as the starting point for this exercise.
  2. Press CTRL+SHIFT+B to build the solution.

Task 1 – Creating the Deployment Package

In this task, you will use the Web Deployment feature inside Visual Studio to create a deployment package.

  1. In the Solution Explorer right-click the RouterService project and select Package/Publish Settings set the options as follows.
  2. Items to deploy using FTP, FPSE, File System or Web Deployment Tool Section:
    1. Only files needed to run this application

      Figure 37

      Items to deploy

  3. Web Deployment Package Settings section:
    1. Create deployment package as a ZIP file
    2. Location: obj\Debug\Package\RouterService.zip
    3. IIS Web Site/Application name to be used on the destination server: Default Web Site/RouterService

      Figure 38

      Web Deployment Package Settings

  4. Press CTRL+SHIFT+S to save all files – this will save your changes.
  5. In the Solution Explorer right-click the RouterService project, and select the Build DeploymentPackage action. You should see Publish succeeded as the status in the bottom left corner when the action has completed.

Task 2 – Deploying the Package

  1. In this task, you will use the Web Deployment feature inside IIS Manager to deploy the package to the local web server.
  2. Open Internet Information Services (IIS) Manager using the Start menu.
  3. Expand the Server node, expand Sites, and right-click the Default Web Site. Select Deploy / Import Application.

    Figure 39

    Import Application in the IIS Manager

    Note:
    Watch Out

    If IIS was not enabled at the time of Visual Studio 2010 installation you may need to install ASP.NET into IIS by running the following command from an Administrator Visual Studio 2010 command prompt aspnet_regiis.exe -iru

    If you don’t see a Deploy menu option it could mean that IIS Web Deployment Tool is not installed or may need to be reconfigured. To fix this you should do the following

    Download the IIS Web Deployment tool from https://www.iis.net/extensions/WebDeploymentTool

    Start the setup

    If setup shows you the Change / Repair / Remove screen select Change and install the IIS Manager UI module.

  4. For Package path browse to the location where the package was created. By default this was in the obj\Debug\Package folder for the RouterService project. Select the RouterService.zip file.

    Figure 40

    Select the package

  5. Click Next 3 times to use the defaults on the rest of the Import Application Package wizard pages. When asked if you want to run this application in the default .NET 4 application pool click Yes.
  6. Click Finish when the wizard has finished.

Task 3 – Changing the Client Application Configuration

While you were developing the solution, you were using the Visual Studio Development Web Server. Now that you deploy your solution in the IIS environment, you are going to use a different endpoint for the Router Service.

  1. Open the app.config file from the CalculatorClient project and modify the RouterService endpoint address with the following configuration.

    (Code Snippet - What is new in WCF4 Lab – RouterService endpoint XML)

    App.config

      <endpoint address="https://localhost/RouterService/Router.svc/general"
    FakePre-9d37efe34ff44ae4993f1876172b89ee-1ae86d16458c45458bc4e11e4f06048eFakePre-27c9ffeedc5a485d83057478a779bfe5-bc9f1cfb91f149c09d8e585f81134038FakePre-bc5f98a54bd849b490c744f12f96a5c2-248c1a41540e47aaa78e195c2b29546cFakePre-0ae3a61449cb4fda82b406bdb56f04fe-a3533d6b56b94004af71f9aeb9772f99

Next Step

Exercise 11: Verification