One-Time Setup Procedure for the Windows Communication Foundation Samples

Download sample

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.

One-time setup procedure for WCF samples

  1. Ensure that ASP.NET is set up. For information about how to set up ASP.NET, see Internet Information Service (IIS) Hosting Instructions.

    If you installed IIS after installing WCF, you must register the appropriate scriptmaps with IIS by running the following command:

    "%WINDIR%\Microsoft.Net\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe" -r
    
  2. If you are running Windows XP SP2, Windows Vista, or Windows Server codename "Longhorn" follow the Firewall Instructions for enabling the ports used by the sample.

  3. Download the setup files from this page.

  4. Open a command window using an account with Administrator privileges. Run the Setupvroot**.**bat batch file.

    • A virtual directory is created named ServiceModelSamples.

    • A disk directory is 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.

    Important   This procedure must be performed only once on a machine.

  5. You must set the ACLs on %systemdrive%\inetpub\wwwroot to grant modify permissions to the account under which you are running. Otherwise some post build events can fail when you build Web-hosted samples. Alternatively, you can leave the ACLs as they are and run the SDK command prompt or Visual Studio as an Administrator.

  6. 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 Server 2003 and Windows Vista the account is NT Authority\Network Service, for Windows XP the account is ASPNET.

  7. Open a Visual Studio command window using an account with Administrator privileges. Run the Setupcerttool.bat file:

    • 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.

  8. 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 information about configuring namespace reservations, see Configuring HTTP and HTTPS.

  9. Some samples require Message Queuing. 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.

Footer image

Send comments about this topic to Microsoft.
© Microsoft Corporation. All rights reserved.