You are on page 1of 32

Hands-On Lab

Windows Server AppFabric Hosting:


Lab 0 - Developer Environment Setup
Lab version: 1.0.0
Last updated: 7/27/2017

Virtual Machine Logon Details:


UserName: Administrator, Password: P2ssw0rd

1
CONTENTS

OVERVIEW 3
Windows 7 Virtual PC4
Hyper-V 6
Changing to Visual C# Development Settings......................................................................................7
Mount the Lab Files .ISO image and copy the files to your Virtual Machine........................................7
Restoring saved Visual Studio Environment settings:..........................................................................8
Starting Materials 8

EXERCISE 1: INSTALLING APPFABRIC 9


Task 1 Run the AppFabric Installation from Media.............................................................................9
Using the Web Platform Installer 9
Installing AppFabric via MSI 10
Exercise 1 Verification 16

EXERCISE 2: INSTALLING FOURTH COFFEE 20


Task 1 Run the Labs Installer...........................................................................................................20

Summary 26

2
Overview
This lab will get your system setup for running the Fourth Coffee labs. This document provides the step-
by-step instructions on how to setup your own PC or how to get started using the Training Kit Virtual PC.

Objectives
Understand the user and setup pre-requisites for the labs and setup the initial Fourth Coffee
development environment
Setup your own machine with the base OS, IIS, Visual Studio and SQLServer or use the preconfigured
VPC image.
Install AppFabric
Install Fourth Coffee

User Requirements
In order to complete these labs you should have experience with:
Developing in C#
Using Visual Studio for development

Setting up a New Computer or Virtual Machine


You must have the following items installed in your development environment to complete these labs,
and should install them in the following order:
Install the operating system. Supported Operating Systems include: Windows 7 (32 bit or 64 bit),
Windows Server 2008 (32 bit or 64 bit), Windows Server 2008 R2 and Windows Vista SP2.
IIS 7 or later. Install the complete list of IIS components (Control Panel|Programs|Turn Windows
Features On and Off. Expand Internet Information Services. For both the Web Managagement Tools and
the World Wide Web Services options, exapnd each one and check ALL of the components.
Microsoft Visual Studio 2010 Professional or higher.
Microsoft Web Deploy v1.1
Microsoft SQL Server 2008 (any edition) or later. SQL Express 2008 may have been installed with
Visual Studio 2010.

3
Have a copy of the WindowsServerAppFabricTrainingKit.iso. This ISO includes the lab
documents, Visual Studio projects and the Windows Server AppFabric installation media.

Setting up the supplied Virtual Hard Disk


The supplied Virtual Hard Disk is an x86-based VHD file with Windows 7 ultimate, IIS, and Visual Studio
2010 installed as per the instructions above. The VHD file is compatible with Windows Server 2008/R2
Hyper-V and with Windows Virtual PC for Windows 7. Follow these instructions for either a Hyper-V
setup or a Windows 7 setup.
.1

Windows 7 Virtual PC
1. Copy the file .VHD to your hard disk from the class setup files.
2. Ensure you have Windows Virtual PC installed. NOTE: This is not the same as Virtual PC 2007.
You can install Windows Virtual PC from http://www.microsoft.com/windows/virtual-pc/
3. Launch Windows Virtual PC and select Create Virtual Machine. Give the machine a name and
click Next. Set the RAM to be 2048 or higher and click Next.
4. Select Use an existing virtual Hard disk and click the browse button to select the VHD file you
copied in step 1. If you want to enable UNDO of changes, select that option. Click Create.
5. Start the virtual machine and log on (see credentials on the cover page).
6. After starting up the VPC on Windows 7, you should see the following:

7. Click Update. This will insert a image containing the setup media into the D: drive.
8. Start->Control Panel
9. Under the Programs group, click the Uninstall a program link.
4
10. In the list select "Virtual Machine Additions" and click the Uninstall button at the top of the list.

11. To the confirmation prompt, click yes.

5
12. Click Yes to the restart prompt.

13. Login to the machine after restarting.


14. Navigate to D:\ and double click on Setup.exe.
15. Click Next to the first dialog and wait for the installation to complete.
16. Click Finish.
17. Click Yes to the restart prompt.
18. After the machine restarts, the additions are now installed.
19. If you want to enable the integration features, log in to the VPC and then from the Windows
Virtual PC toolbar, select Tools->Enable integration features (use the login
AppFabricVM\Administrator and the password you use for the VPC in the prompt that appears).
20. Install the lab files.
a. To do this, locate the Lab Files which will be contained in an .ISO file that you can mount
to the Virtual Machine. The Files are called AppFabricTrainingKit.iso
b. From the Windows Virtual PC toolbar, select Tools | Settings
c. Click on the DVD Drive and in the right hand pane select Open an ISO Image. Browse to
the location of the Lab files to select it and then click Open and then OK.
d. In the Virtual Machine, select Start | Computer and open the DVD drive folder
e. If the disc does not auto-play, double click on AppFabricTrainingKit.Setup.exe.
f. This will install all the lab files. Notice that the installation media for Windows Server
AppFabric is available under the AppFabric Setup folder on mounted disc.
g. You are now ready to start the labs.
.2

Hyper-V
.3 Copy the folder containing the .VHD file to your hard disk, including all the subfolders.
.4 From Hyper-V Manager, select Import Virtual Machine and browse to the folder location in
the first step above.
6
.5 Select the Copy the virtual machine option and click Import. When this has completed, Start
the virtual machine (Memory is set at 2096 MB, so go to setting to change this if necessary).
.6 You will need to uninstall the existing Virtual Machine additions and re-install the Hyper-V
additions.
.7 Install the lab files.
.8 Mount the AppFabricTrainingKit.iso.
.9 In the Virtual Machine, select Start | Computer and open the DVD drive folder
.10 If the disc does not auto-play, double click on AppFabricTrainingKit.Setup.exe.
.11 This will install all the lab files. Notice that the installation media for Windows Server
AppFabric is available under the AppFabric Setup folder on mounted disc.
.12 You are now ready to start the labs.

Visual Studio Setup


All of the Fourth Coffee labs are in C#, with Visual Studio configured to use the Visual C# Development
Settings. If you encounter shortcuts or screenshots that do not match your environment while following
along with the labs, your system may be configured to use a different environment. To temporarily
change your settings to Visual C# Development Settings, follow these steps.
Changing to Visual C# Development Settings
.1 Open Visual Studio 2010.
.2 From the Tools menu, choose Import and Export Settings
.3 In the Welcome dialog, choose the Reset all settings option and click Next.
.4 In the Save Current Settings dialog, choose Yes, save my current settings. Provide a file name
and specify the path where you would like to back your current Visual Studio environment
settings. Click Next.
.5 Select Visual C# Development Settings from the Choose a Default Collection of Settings dialog
and click Finish.
.6

Mount the Lab Files .ISO image and copy the files to your Virtual Machine

7
.7 To do this, locate the Lab Files which will be contained in an .ISO file that you can mount to
the Virtual Machine. The Files are called AppFabricHostingLabFiles.iso
.8 From the Windows Virtual PC toolbar, select Tools | Settings
.9 Click on the DVD Drive and in the right hand pane select Open an ISO Image. Browse to the
location of the Lab files to select it and then click Open and then OK.
.10 In the Virtual Machine, select Start | Computer and open the DVD drive folder. Copy
AppFabricTrainingKit.Setup.exe on the DVD drive to your desktop.
.11 Double-Click on the file. In the location dialog, enter C:\AF or some other short folder name
of your choice. This folder name will then be represented in all the lab instructions during the
rest of the labs as %InstallFolder%. This might take some time as there are over 20,000 files to
uncompress.

When you have finished with the labs, you can restore your Visual Studio environment settings with the
following steps:
Restoring saved Visual Studio Environment settings:
.1 Open Visual Studio 2010.
.2 From the Tools menu, choose Import and Export Settings
.3 In the Welcome dialog, choose the Import selected environment settings option and click
Next.
.4 In the Save Current Settings screen, choose No, just import new settings. Click Next.
.5 Within the Choose a Collection of Settings to Import, Click Browse and navigate to select the
vssettings file you exported previously.
.6 Click Next.
.7 Click Finish.
.8

Exercises
This Hands-On Lab comprises the following exercises:
.9 Installing AppFabric
.10 Installing Fourth Coffee

Estimated time to complete this lab: 20 minutes.

8
Starting Materials
Use the Self Install Training Kit referenced above.

9
Exercise 1: Installing AppFabric
In this exercise, you will install the AppFabric and configure it for use with Fourth Coffee. Be sure you
have run through the Initial System Setup Procedure section before proceeding.

Task 1 Run the AppFabric Installation from Media


AppFabric must be installed after installing IIS. You can install AppFabric either using MSI or with the
Web Platform Installer. Both methods are covered here.

Using the Web Platform Installer


AppFabric is installable from the Web Platform Installer (WebPI). WebPI is a download available from
Microsoft.com/web.
.1 Once WebPI is open, the Enterprise tab will not be visible by default. To enable this tab, click
the options link at the bottom left corner of the window then check the Enterprise option
and click OK.

10
.2 With the Enterprise tab selected, check Windows Server AppFabric and click the Install
button at the bottom of the WebPI window.

This approach is good to use when installing your development environment. It will automatically setup
the complete caching and hosting features of AppFabric. However, for the setup of production
environments you should still use the MSI. It is not recommended to install AppFabric's Caching and
Hosting features on the same production server.

Installing AppFabric via MSI


AppFabric ships as a single executable called WindowsServerAppFabricSetup that must run after
installing IIS. There are four different installers depending on your installation platform:

Platform Package

Windows Vista and Windows Server 2008 x64 *_amd64_6.0.exe

Windows 7 and Windows Server 2008 R2 x64 *_amd64_6.1.exe

Windows Vista and Windows Server 2008 x86 *_x86_6.0.exe

Windows 7 x86 *_x86_6.1.exe


.3 Double click appropriate WindowsServerAppFabricSetup_*.exe to launch the installer. If you
are using the provided VPC for this class, you will need to select the Windows 7 x86 setup
option.

11
.4 Accept the license and click Next.

12
.5 On the Customer Experience Improvement screen, select the options as fits you prefer and
click Next.

.6 On the Feature Selections screen, check only the option for Hosting Services. The Distributed
Cache features (Service, Client and Admin) install components of high-performance, distributed

13
cache which is neither used by theHost or these labs, and so is not needed here.

.7 Click Next.

14
.8 On the Confirmation Screen, click Install to begin the installation.

15
.9 On the Installation Results, ensure that the Launch configuration tool checkbox is checked
and click Finish.

16
.10 The Windows Server AppFabric Configuration Wizard will appear. Select the option that suits
you for the Customer Experience Improvement Program and click Next.

.11 The Configure Hosting Services dialog appears which will configure the default store used for
collecting WCF and WF events for all sites and applications hosted on the system as well as the

17
persistence of workflow service instances. Check the Set monitoring configuration box.

.12 This will enable the Event Collector service account and Monitoring provider sections. In the
Monitoring Provider drop down list, choose the SqlClient provider.
.13 Click the Configure button that is enabled to the right of the Monitoring provider list.
.14 In Configure SQL Monitoring Store dialog that appears, check the Add monitoring store
registration to root web.config and Initialize monitoring store checkboxes, and change the

18
name of the Database to AppFabricMonitoring.

.15 Click OK.


.16 In the prompt that appears, click Yes.

19
.17 Back on the Configure Hosting Services screen, Check the Set persistence configuration box
and selecte the sqlStoreProvider from the Persistence provider drop down list. This
enablesconfiguration of persistence store settings which will define the default database used to
store the serialized state of workflow instances.

.18 Click the Configure button to the right of the Persistence provider drop down.
.19 In the Configure SQL Persistence Store screen, check the Add persistence store registration
to root web.config and Initialize persistence store checkboxes, and change the name of the
Database to ApplicationServer. Click OK.
.20 Click Yes to the prompt.
.21 Your Configure Hosting Services screen should look similar to the following.Click Next.

.22 On the Configure Application dialog of the setup, leave the Start Internet Information
Services Manager checkbox checked, click Finish to complete the installation. IIS Manager will

20
be displayed, leave it open for the Verification steps that follow.

Exercise 1 Verification
In order to verify that you have correctly performed all steps of exercise 1, proceed as follows:

Verification
In this verification, you spot check the installation of Windows Server AppFabric and verify that the
persistence and monitoring databases settings have been configured for the server.
.1 If IIS Manager is not already open, from the Start Menu, select All Programs and choose
Windows Server AppFabric->Internet Information (IIS) Services Manager. If this shortcut is
present and launches IIS, the install was successful.
.2 Next, you will check that the default database connection strings were created. Once IIS
Manager loads, use the Connections tree and click the server node and observe the AppFabric

21
section appears in the center pane, as shown:

22
.3 Right click the Server node in the Connection tree, select Manage WCF and WF Services-
>Configure

.4 In the window that appears, click the Monitoring tab and verify that the Connection string
value appears as shown.

23
.5 Click Workflow Persistence tab, change the radio button selected from Custom to Sql Server
Workflow Persistence and select the defaultSqlPersistenceStore item in the drop down. You can
ignore the warning about NET.PIPE for the moment. Click OK and Yes to the recycle prompt.

24
Exercise 2: Installing Fourth Coffee
In this exercise, you will perform the preliminary steps necessary to build and run the Fourth Coffee labs.

Task 1 Run the Labs Installer


.1 Extract the training kit files by running AppFabricTrainingKit.Setup.exe.
.2 From the %InstallFolder%\Assets directory, double-click Setup.cmd to configure the lab
environment on your machine. This will run the Configuration Wizard as shown (the LabStarter
will also load in the background, but you should ignore it until you have completed this setup).

.3 Click Next.
.4 Click Next on the Steps Summary screen.

25
.5 Ensure all pre-requisites have been met and click Next on the Detecting Required Software
screen.

.6 Allow the Wizard to configure the various components. Do not close any of the command
windows that appear.
.7 The Visual Studio Content Installer will appear. Click Next to install the snippets. Some of the
labs include long or complex code samples. Instead of copying and pasting from the documents,
we have provided code snippets that you can use.
.8 In the Select content to install dialog that appears, leave everything checked and click Next.
.9 Click Yes to the prompt called No Signature Found
.10 In the next screen, shift-click to select the first Code snippet item on the left pane and then
the last Code snippet item to select all of them. In the Location tree view, ensure Microsoft

26
Visual Studio 2010\My Code Snippets is checked, as shown:

.11 Click Next.

27
.12 For the TrackingProfile snippet, ensure that My XML Snippets is checked as well:

.13 Click Next.


.14 Click Finish.
.15 Click Close to exit the Visual Studio Content Installer.
.16 Click Close to exit the completed Configuration Wizard.

Note: You should leave the LabStarter open if you will be jumping right into a lab. If you close
it, you can always access it from %InstallFolder%\Assets\LabStarter.exe

Exercise 2 Verification
In order to verify that you have correctly performed all steps of exercise 1, proceed as follows:

Verification
In this verification, you will build and run the Fourth Coffee solution using a test client to submit an order
directly to the Labeling Service workflow service.
.17 From the LabStarter, click Lab 1: Fourth Coffee Solution Overview button.
.18 Rebuild all projects in the solution. Ignore the warnings.
.19 Right click the TestClient project and choose Set as Startup Project.

28
.20 Press Ctrl+F5 to run the TestClient. A window like the following should appear.

.21 Type 4 and press Enter. This will submit a test order for processing by the Labeling Service,
which will create an image in the working directory configured in this exercise. The initiated
workflow service instance will then persist waiting for the cleanup command. The result
should appear similar to the following:

29
.22 Press ENTER again. This will delete the label image generated by the Labeling Service in this
test run and complete the workflow service instance. The output should appear as follows:

.23 Now we will use the AppFabric Hosts monitoring to verify that the Labeling Service instance
completed successfully. Open IIS Manager.
.24 In the Connections pane, expand the server node, Sites, Default Web Site and click on
LabelingService.
.25 In the central pane, under the AppFabric section double click the AppFabric Dashboard
feature.
.26 In the Dashboard for the LabelingService, under the WF Instance History section, click the
Completions link.

30
.27 Verify that the instance just run (as determined by examining the Completion Time column)
has a status of Completed (Successfully).

31
Summary
In this lab you have built a stand alone service. Along the way you have seen how to easily call other
services.

32

You might also like