One-Time Set Up Procedure for the Windows Communication Foundation Samples
Most of the Windows Communication Foundation (WCF) samples are hosted in Internet Information Services (IIS) and run from a common virtual directory. This one-time setup procedure creates a folder on the disk and virtual directory named Servicemodelsamples.
The Servicemodelsamples virtual directory is used for building and running all samples that use an IIS-hosted service. This is the only virtual directory that is required to run the samples. The most recent sample that is built is deployed and available at this virtual directory. Building another sample replaces the previously deployed service at this virtual directory.
Note
In the following procedure, you must run all commands under a local administrator account. If you are using Windows Vista or Windows Server 2008, you must also run the command prompt with elevated privileges. To do so, right-click the command prompt icon, then click Run as administrator. All commands in this topic must be run in a command prompt that has the appropriate path settings. The easiest way to ensure this is by using the Visual Studio Command Prompt. To open this prompt, click the Start button, select All Programs, scroll down to Visual Studio 2008, select Visual Studio Tools, right-click Visual Studio 2008 Command Prompt, and choose Run as administrator. If you have one of the Visual Studio Express editions installed, this command prompt is not available, so you must add "C:\Windows\Microsoft.Net\Framework\v3.5" to the system path.
One-time setup procedure for WCF samples
Ensure that .NET Framework 3.0 is installed. Some samples rely on .NET Framework version 3.5; therefore, if you intend to run them, ensure that .NET Framework 3.5 is installed.
Ensure that ASP.NET is set up. For more information about how to set up ASP.NET, see Internet Information Service Hosting Instructions.
If you installed IIS after installing WCF, you must register the appropriate scriptmaps with IIS. If you are running Windows Vista or Windows Server 2008, ensure that you performed the HTTP Activation procedure in step 2. If you are using Windows XP SP2 or Windows Server 2003, run the following command.
Note
If you are using Windows Vista or Windows Server 2008, do not run this command.
"%WINDIR%\Microsoft.Net\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe" -r
If you installed .NET Framework 3.5, run the following command.
"%WINDIR%\Microsoft.Net\Framework\v3.5\WFServicesReg.exe" /c
Follow the Firewall Instructions for enabling the ports used by the sample.
Download the setup files from this page.
Run the Setupvroot.bat batch file.
A virtual directory is created named Servicemodelsamples.
Disk directories are created named %SystemDrive%\Inetpub\wwwroot\servicemodelsamples and %SystemDrive%\Inetpub\wwwroot\servicemodelsamples\bin.
If you prefer to set up these directories manually, see the Virtual Directory Setup Instructions.
Note
This procedure must be performed only once on a computer.
You must grant modify permission for %SystemDrive%\inetpub\wwwroot to the account under which you are building the samples. While building, some Web-hosted samples attempt to copy the compiled binaries to the previously mentioned location, and if you have not set the appropriate permissions, the build breaks. Alternatively, you can leave the permissions as they are and run the SDK command prompt or Visual Studio as Administrator.
Note
If this step is not completed, all IIS-hosted samples fail while building. Ensure that you set the permissions correctly, or run both the SDK command prompt and Visual Studio as Administrator.
Create a c:\logs directory on the computer for the use of some samples (such as the Extending Control Over Error Handling and Reporting sample) that expect it, and give the appropriate account write access to the folder. For Windows Vista and Windows Server 2008, the account is NT Authority\Network Service; for Windows XP and Windows Server 2003, the account is ASPNET.
Run the Setupcerttool.bat file. This file is located in the \TechnologySamples\Setup\CS (or \TechnologySamples\Setup\VB) folder under your WCF samples installation folder:
The FindPrivateKey tool is built.
A directory is created at %ProgramFiles%\ServiceModelSampleTools.
FindPrivateKey is copied to this directory.
This tool is required for samples that use Certificates and are hosted in IIS.
Samples that are self-hosted (not hosted in IIS) require permission to register HTTP addresses on the machine for listening. The permission for an HTTP namespace reservation comes from the user account used to run the sample. By default, administrator accounts have the permission to register any HTTP address. Non-administrator accounts must be granted permission for the HTTP namespaces used by the samples. For more information about how to configure namespace reservations, see Configuring HTTP and HTTPS.
Some samples require Message Queuing (formerly known as MSMQ). See Installing Message Queuing (MSMQ) for installation instructions.
Note For security purposes, remove the virtual directory definition and permissions granted in the setup steps when you are finished with the samples by running the batch file named Cleanupvroot.bat.
© 2007 Microsoft Corporation. All rights reserved.