Scenario: Auto Deploy CA Plex WCF Services to Internet Information Services (IIS)


1.0 Verify the Prerequisites on the Server

1.1 Verify that All IIS Related Features are Enabled

1.2 Install the Web Deploy Tool

1.3 Install, Configure and Access Microsoft SQL Server With Windows Authentication

1.4 Configure IIS and SQL Server to Use Windows Authentication

1.4.1 Configure IIS

1.4.2 Configure SQL Server

2.0 Verify the Prerequisites on the Client

3.0 Auto Deploy WCF Service to IIS Using the Code Library Wizard

4.0 Verify the Availability of the Deployed WCF Service

4.1 Confirm that the WCF Service is Deployed to IIS

4.2 Launch the WCF Service From Internet Explorer

4.3 Run the WCF Service From SoapUI

4.4 Troubleshooting

5.0 Copyright

This scenario discusses how CA Plex developers can configure the environment for deploying CA Plex WCF Service to Internet Information Services (IIS) using CA Plex Code Library Wizard. This scenario also covers the runtime configuration to allow IIS deployed WCF Service to access SQL Server databases with Windows Authentication. .

Note: This documentation assumes that there are two machines, one used for the IIS with Microsoft SQL Server installed in it (referred as Server) and the other running CA Plex (referred as Client).

Scenario diagram to auto deploy CA Plex WCF service to IIS

Follow these steps to complete this scenario:

  1. Verify the Prerequisites on the Server
  2. Verify the Prerequisites on the Client
  3. Auto Deploy WCF Service to Internet Information Services Using the Code Library Wizard
  4. Verify the Availability of the Deployed WCF Service

1.0 Verify the Prerequisites on the Server

Internet Information Services (IIS) can be installed as part of most versions of the Windows operating system. The version of IIS that can be installed on each operating system is listed in Microsoft Support knowledge base article KB224609. We recommend that you use at least IIS 7.5 running on Windows 7 /2008 R2.

Following are the prerequisites for the Server (IIS Machine):


1.1 Verify that All IIS Related Features are Enabled

For IIS 8.5 on Windows 8.1—Click Start, Control Panel, Programs and Features, and select Turn Windows Features on or off. Make sure that ALL of the features in the following list are enabled in the Turn Windows Features on or off dialog and click OK to confirm your selection.

Note: Do not modify the settings for other features that have been previously enabled in the Turn Windows Features on or off dialog.

Windows proceeds to install and configure the necessary components based on your selection. Reboot, if required.

For Windows Server 2008 R2, follow these steps:

  1. Click Start, Server Manager icon.
  2. Click Add roles and features.
  3. Continue with the default selections on the wizard.
  4. Click Select a server from the server pool and click Next.
  5. Check the Web Server (IIS) box and click Next.
  6. Check the following role services and click Install:

Windows proceeds to install and configure the necessary components based on your selection.


1.2 Install the Web Deploy Tool

Use the following procedure to install the Web Deploy Tool to deploy WCF service to IIS.

Follow these steps:

  1. Navigate to the following website: http://www.microsoft.com/web/downloads/platform.aspx
  2. Click Free Download and complete the installation.
  3. Open Web Platform Installer.
  4. Click in the search bar in the In Web Platform Installer, type Recommended and press Enter.
  5. Select Recommended Server Configuration for Web Hosting Providers, and then click Add.
  6. Click Install.
  7. Click I accept on the Prerequisites page.
  8. Click Finish after the installation process has completed.

1.3 Install, Configure and Access Microsoft SQL Server With Windows Authentication

Use the following procedure to install and access Microsoft SQL Server with Windows authentication.

Follow these steps:

  1. Install Microsoft SQL server to the Server machine.
  2. Add your Window User to access SQL Server with Windows Authentication.
  3. Open Microsoft SQL Server Management Studio and connect to the SQL Server on the Server.
  4. Expand Security.
  5. Right-click Logins and select New Login.

    The Login - New dialog opens.

  6. Enter Login name as your Windows User ID.
  7. Select the default database your want to use to build a Table and View from CA Plex.
    Otherwise, you can use the default database, master.
  8. Click OK to apply your changes and exit the dialog.

1.4 Configure IIS and SQL Server to Use Windows Authentication

You must allow your IIS to access SQL Server configuration using a known, trusted Windows credential. Proceed to the next section to understand how to configure IIS and SQL server configuration.

Note: Alternatively, you can change your connection string to use SQL authentication.

Complete the following tasks:


1.4.1 Configure IIS

Use the following procedure to configure IIS.

Note: You must have administrator access to your computer to configure IIS.

Follow these steps:

  1. Open the Internet Information Services Console.

    Note: To open IIS console, click Start, Run, type inetmgr and click OK.

    The Internet Information Services Manager window opens.

  2. Select the top-level server node and double-click the Authentication icon to open the Authentication page.
  3. Make sure that Anonymous Authentication is Enabled.
  4. Right-click Anonymous Authentication and select Edit. Select Application Pool Identity and click OK to exit the Anonymous Authentication Credential dialog.
  5. Select Application Pools under the root server node to open the Application Pools page.

    By default, you must be using an application pool called DefaultAppPool.

  6. Right-click DefaultAppPool and select Advanced Settings to open the Advanced Settings dialog. Do the following to configure the application pool:
    1. Scroll down to locate and select the Identity property.
    2. Click the ellipsis (…) next to the name listed.

      The Application Pool Identity dialog opens.

    3. Select NetworkService from the list of built-in accounts and click OK.
    4. Click OK to exit the dialog.
  7. Open Windows Explorer, locate and right-click the folder C:\inetpub\wwwroot and select Properties. Set the folder permissions to your local machine. To change the folder permissions, do the following:
    1. Select the Security tab and click Edit.
    2. Click Add to add a new credential.
    3. Make sure that the local machine name is selected in the From this location field, enter Network Service as the object name, and click Check Names.

      The object entry now changes to an underlined NETWORK SERVICE entry, indicating that the credential is available.

    4. Click OK to confirm the changes and exit the dialog.
    5. Make sure that all permissions for the NETWORK SERVICE credential are selected in the Permissions for wwwroot dialog. Click OK.
  8. Click Advanced in the Security tab. To set advanced security settings, do the following:
    1. Select Change Permissions.

      The Permissions dialog opens.

    2. Check the Replace all child object permission entries with inheritable permission entries from this object box.
    3. Click Apply. A confirmation message displays. Click YES to confirm your selection.
  9. Click OK twice to save your changes.

1.4.2 Configure SQL Server

Use the following procedure to configure SQL Server.

Follow these steps:

  1. Log on to SQL Server Management Studio.
  2. Expand the Security folder, right-click Logins and select New Login.
  3. Select Search next to the Login name and search for the NETWORK SERVICE credential on the local machine. Select the credential and click OK to confirm the credential details.
  4. Select the Server Roles tab. Make sure that both public and sysadmin values are selected. Click OK to confirm the new credential.

You have successfully configured the NETWORK SERVICE credential to be used for running the IIS default application pool and also to be accepted as a valid Windows credential by your SQL Server instance.


2.0 Verify the Prerequisites on the Client

Following are the prerequisites on the Client (machine on which CA Plex is installed):

  1. Verify that Microsoft Visual Studio 2010 Shell (Isolated) Redistributable Package is Installed on the Client.

    Note: This prerequisite is needed ONLY if Visual Studio 2010 is not installed on the Client.

    If Visual Studio 2010 is not installed, the following error message is displayed when you run Code Library Wizard:

    error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

    To troubleshoot, search and download Microsoft Visual Studio 2010 Shell (Isolated) Redistributable Package from Microsoft Download Center (http://www.microsoft.com/en-us/download) and continue with the download.

  2. Verify that Web Deploy 3.5 is Available

    If Web Deploy 3.5 is not installed on the Client, the following error message is displayed when you deploy WCF Service to IIS.

    error MSB4057: The target "Package" does not exist in the project.

    To troubleshoot, search and download Web Deploy 3.5 from Microsoft Download Center.


3.0 Auto Deploy WCF Service to IIS Using the Code Library Wizard

This section discusses how to auto deploy WCF Services to Internet Information Services (IIS) using the Code Library Wizard.

Follow these steps:

  1. Generate, build and test your Plex client-server application.

    Important! You must start with a fully functioning Plex client-server application so that the functions you want to expose as service operations execute in the Plex environment correctly.

    Do the following:

    1. Get the SalesSystem.mdl sample model up and running.

      Follow the steps as outlined in the sample model ‘Dot NET Support and Code Libraries’.

      The sample models are available in the following directory:

      • SalesSystem.complete.iis.mdl
        Samples\Dot NET WCF Web Service Deployment\
    2. Make sure that when you set up ODBC DSN to build Table and View, the ODBC driver must indicate the SQL Server on the IIS Server machine and use Windows Authentication.

      Note: To understand and learn about WCF service and required modeling concept, refer the sample model ‘Dot NET WCF Support’.

  2. Deploy the WCF Service to IIS with Code Library Wizard:

    You must run the Code Library Wizard to deploy Order Code Library with OrderService Package deployed to IIS:

    1. Run the Code Library Deployment Wizard. Click Tools, Code Library Wizard.
    2. Click Next.
    3. Select Order Code Library and click Next.
    4. Click Next.
    5. Select WCF Services from the drop-down list in the Plugin Options page.
    6. Expand IISProperties.
    7. Set the Deploy to IIS property to True.
    8. Enter the name of the server on which you have IIS set up, your Windows User Name and Password. Click Next

The IIS deployment process gets triggered. The process includes the following steps:

  1. Compile Code Library Order as Assembly that contains Functions
  2. Compile Package OrderService as IIS deployable Assembly
  3. Package all required files to be deployed to IIS including Code Library Order Assembly
  4. IIS deployment

Note the Code Library Creation page display a message to indicate that the Code Library creation is complete.

If you receive any error, see Troubleshooting.


4.0 Verify the Availability of the Deployed WCF Service

Do the following tasks:


4.1 Confirm that the WCF Service is Deployed to IIS

Use the following procedure to confirm if the WCF Service is available in IIS.

Follow these steps:

  1. Start Internet information Service (IIS) Manager on the Server.
  2. Navigate to Sites, Default Web Site on the left pane and locate the WCF Service.

You can see OrderService deployed under Default Web Site as follows:

Internet Information Services Manager Window


4.2 Launch the WCF Service From Internet Explorer

Use the following procedure to confirm if the WCF Service is actually deployed.

Follow these steps:

  1. Open Internet Explorer on your Client machine (where CA Plex is installed)
  2. Type the following URL and click Go.

    http://<Your Server Name>/OrderService/Order.Component.svc

    The web page for the WCF Service is displayed:

    Web Browser showing WCF Service


4.3 Run the WCF Service From SoapUI

There are various way to test Soap based Web Service. This section discusses how to test using SoapUI 5.1.

Use the following procedure to confirm if the WCF Service actually runs.

Note: Instructions to download and additional information about SoapUI are available at http://www.soapui.org/.

Follow these steps:

  1. Run the SoapUI on the Client (on which CA Plex is installed).
  2. Select File, New Soap Project to create a new project for your service.

    The New Soap Project dialog opens. Project Name is automatically filled; you may change it if you want.

  3. Enter the Initial WSDL as follows:

    http:// <Your Server Name>/OrderService/Order.Component.svc?wsdl

  4. Click OK.

    A new Soap project is created.

  5. Expand the tree on the left pane.
  6. Double-click Request 1.
  7. Enter Y for ord:Position, and enter 0 for both ord:RowsFetches and ord:ORDERNUMBER.
  8. Click the Run button to submit the request.

    Process of requesting a service operation includes the following:

    1. SoapUI invokes OrderServcie Web Service Operation.
    2. The Web Service Operation invokes CA Plex function.
    3. The CA Plex Function accesses SQL Server.
    4. The data is returned to SoapUI as Soap Envelop.

    The right pane shows the requested service.data as follows:.

    Call the Web Service from SoapUI

    See Troubleshooting if the requested service data is not returned.


4.4 Troubleshooting

This section lists the error messages and action to be taken against each message under the following topics:

Code Library Wizard Error messages

Code Library Wizard Error messages

Error on IIS deployment: The remote name could not be resolved: 'Your Server Name' [C:\Documents and Settings\All Users\Documents\CA\Plex\7.2\SAMPLES\Dot NET WCF Support\GEN\Services\Wcf\OrderService\OrderService.csproj]

Cause:

Indicates that a wrong Server name is entered, for example Server does not exist.

Solution:

Enter a correct Server Name and run the Wizard again.

Error on IIS deployment: Unable to connect to the remote server [C:\Documents and Settings\All Users\Documents\CA\Plex\7.2\SAMPLES\Dot NET WCF Support\GEN\Services\Wcf\OrderService\OrderService.csproj]

Error on IIS deployment: No connection could be made because the target machine actively refused it 130.200.243.109:80 [C:\Documents and Settings\All Users\Documents\CA\Plex\7.2\SAMPLES\Dot NET WCF Support\GEN\Services\Wcf\OrderService\OrderService.csproj]

Cause:

The Target Server does not have IIS running. (The server exists but IIS is not set up.)

Solution:

Make sure IIS is set up on the target server and run the Wizard again.

Error on IIS deployment: Site 'Your Web Site' does not exist. [C:\Documents and Settings\All Users\Documents\CA\Plex\7.2\SAMPLES\Dot NET WCF Support\GEN\Services\Wcf\OrderService\OrderService.csproj]

Cause:

An incorrect Web Site name is entered.

Solution:

Make sure to enter correct Web Site Name and run the Wizard again.

Error on IIS deployment: The remote server returned an error: (401) Unauthorized. [C:\Documents and Settings\All Users\Documents\CA\Plex\7.2\SAMPLES\Dot NET WCF Support\GEN\Services\Wcf\OrderService\OrderService.csproj]

Cause:

You entered wrong User Name or Password OR the User you entered does not have required Authority to do remote IIS deployment.

Solution:

Make sure enter correct User Name and password OR If the User Name and Password is correct, make sure the User is a part of administrator group on the IIS server machine. And run the Wizard again.

Runtime Troubleshooting

WCF Service Connector operations return an Environment<*Returned status> of ERR if they perform any database transaction

Also, you may see the following message in the WCF Service runtime application log:

8/6/2014 1:49:15 PM Type=0 [PLEX0021] Cannot connect to a Database. Please check your property value of UDLFileName, User and Password setting and UDL file ;Server=(local);Database=;MultipleActiveResultSets=True;Server=localhost;Trusted_Connection=True; exists and has correct settings.

8/6/2014 1:49:15 PM Type=0 Login failed for user 'USER001-WIN81$'.

Cause:

Your SQL Server database did not authorize the Windows user credentials hosting the IIS process.

Solution:

Make sure that you follow and complete the steps described in Install, Configure and Access Microsoft SQL Server With Windows Authentication and Configure Internet Information Services (IIS) and SQL Server to Use Windows Authentication.

Calling GetOrderHeaders a second time passing ‘N’ in the Control<Position> field does not return the expected records.

If your sample data includes more than six orders and you have successfully called the GetOrderHeaders SOAP operation passing ‘Y’ in the Control<Position> field and retrieving the first 6 orders, you can subsequently pass ‘N’ in Control<Position> to get the next set of records. However, calling GetOrderHeaders a subsequent time does not return any data. Also, Environment<*Returned status> will be set to INF.

Cause:

The WCF Service Connector is hosted using a binding protocol (basicHttpBinding) that does not support sessions to be stored in IIS for a client. Hence, the SQL result sets created by the CA Plex .NET runtime for the Order.Header.BlockFetch function are not stored between client calls.

Solution:

The solution depends on whether the overhead of introducing session management for your WCF Service Connector is acceptable to you or not.

Perform one of the following steps to resolve this problem:


5.0 Copyright

Copyright © 2014 CA. All rights reserved. All trademarks, trade names, service marks, and logos referenced herein belong to their respective companies.