Jaa


Lesson 2: Deploying the HRApplicationServices Workflow Service

Objective: Learn how to set the deployment settings on a workflow service project in Visual Studio, and create the deployment package (a *.zip file). Then use the Internet Information Services (IIS) Management tool to deploy the package on IIS.

Purpose: To deploy an application that includes WCF and/or WF services.

Prerequisites

Note the following prerequisites before you begin this lesson:

Creating a Deployment Package

To set deployment values in Visual Studio

  1. Open Visual Studio 2010 and run it as administrator. On the Start menu click All Programs, open the Visual Studio 2010 folder, right-click Microsoft Visual Studio 2010 and click Run as administrator.

  2. Build the solution. On the Build menu click Build Solution, or press F6.

  3. Expand the HRApplicationServices node. This node contains the workflow service that you will deploy.

  4. Expand the Web.config node. Not that there are two sub nodes: Web.Debug.config and Web.Release.config.

  5. Open the Web.Release.config file and examine its contents. The default file contains only four elements: <xml>, <configuration>, <system.web> and <compiliation>. However the completed configuration file contains the following code:

    <configuration xmlns:xdt=
           "https://schemas.microsoft.com/XML-Document-Transform">
      <!--Modify the BaseURI key -->
      <appSettings>
        <add key="BaseURI"
             value="https://localhost/HRApplicationServices"
             xdt:Transform="SetAttributes(value)"
             xdt:Locator="Match(key)"/>    
      </appSettings>
      <system.serviceModel>
        <client>
          <!--Modify the endpoint addresses for production -->
          <endpoint
            address="https://localhost/HRApplicationServices/SubmitApplication.xamlx"
            binding="basicHttpBinding"
            bindingConfiguration="BasicHttpBinding_IApplicationService"
            contract="IApplicationService"
            name="BasicHttpBinding_IApplicationService"
            xdt:Transform="SetAttributes(address)" xdt:Locator="Match(name)"/>
        </client>
      </system.serviceModel>
      <system.web>
        <compilation xdt:Transform="RemoveAttributes(debug)" />
      </system.web>  
    </configuration>
    

    Note the <appSettings> element.

    <appSettings>
        <add key="BaseURI"
             value="https://localhost/HRApplicationServices"
             xdt:Transform="SetAttributes(value)"
             xdt:Locator="Match(key)"/>    
      </appSettings>
    

    When deployed using MSDeploy, the transform will instruct the MSBuild process to locate the BaseURI node in the <appSettings> XML element and replace the attribute value with the one defined here: https://localhost/HRApplicationServices

    When the project is built and the configuration file created, the following line appears in the transformed web.config:

    <appSettings>
        <add key="BaseURI" value="https://localhost/HRApplicationServices" />
      </appSettings>
    
  6. The configuration also contains the <system.ServiceModel> element which defines the Windows Communication Foundation (WCF) values needed to connect to the service. In brief, the section supplies the address, binding, and contract information for the service. For more information, see Configuring Services Using Configuration Files.

  7. On the Visual Studio toolbar switch the configuration from Debug to Release.

    Visual Studio: Switch to Release

  8. In the Solution Explorer right-click the HRApplicationServices project, and click Package/Publish Settings. This opens the Package/Publish Web section of the project’s properties page.

  9. Under Items to deploy (applies to all deployment methods) ensure that Only files needed to run this application is selected.

  10. Under Web Deployment Package Settings ensure that Create deployment package as a zip file is checked.

  11. Copy the location where the package will be created to the clipboard. By default it is:

    Obj\Release\Package\<solution name.zip>

  12. Set the IIS Web Site/Application name to be used on the destination server.

  13. Save all files in the solution.

To Create the Deployment Package

  • Right-click HRApplicationServices and click Build Deployment Package. You should see Publish succeeded as the status in the bottom left corner when the action has completed.

Importing the Application into IIS

In this section you will deploy the application and edit the Bindings setting to enable AppFabric to use the net.pipe protocol for communication.

To Import the HRApplicationServices Application

  1. Open IIS Manager by clicking Start > Run and typing inetmgr.

  2. Expand the Server node, expand Sites and right-click Default Web Site. Then click Deploy/Import and click Import Application.

  3. Paste the path of the application’s .zip file into the dialog box.

  4. In the Install an Application Package dialog, you will see the application and the database. Accept the default values.

  5. Click Next three times to use the defaults on the rest of the Import Application Package wizard pages. When asked to run this application in the default .NET 4 application pool click Yes.

  6. The Summary page will provide a high-level overview of some items that were installed from the package. The Details tab will give a lot of detail of exactly what was added.

Enabling the net.pipe Protocol

AppFabric installs a Workflow Management Service (WMS) that works with the workflow persistence store to provide reliability and instance control. WMS communicates with the workflow service using the net.pipe protocol. Therefore, this protocol must be enabled on the application.

To Enable the net.pipe Binding

  1. In IIS Manager right-click Default Web Site and click Edit Bindings….

  2. In the list, look for net.pipe with an asterisk (*) for its Binding information. If it is not present:

    1. Click the Add button.

    2. In the Add Site Binding dialog, select net.pipe.

    3. In the Binding Information box type an asterisk (*).

What Did I Just Do?

In this lesson, you set the deployment settings in Visual Studio then created a deployment package. You also deployed the application by importing the package into the IIS Manager. Finally, you enabled AppFabric to communicate to your application using the net.pipe protocol.

Next Steps

Go to Lesson 3: Configuring the HRApplicationServices Application to configure AppFabric for monitoring and persistence.

See Also

Concepts

Lesson 1: Getting Started
Lesson 3: Configuring the HRApplicationServices Application
Lesson 4: Monitoring the Health of the HRApplicationServices Application
Lesson 5: Resuming a Suspended Workflow Using AppFabric

Other Resources

Lesson 6: Monitoring the Order Service for Exceptions

  2012-09-12