BrainDump
  Home arrow BrainDump arrow Using Service Templates with Indigo
Iron Speed
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Download TestComplete 
Windows Web Hosting
 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
BRAINDUMP

Using Service Templates with Indigo
By: O'Reilly Media
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2008-04-17

    Table of Contents:
  • Using Service Templates with Indigo
  • Service Configuration Editor
  • ServiceHost Initialization
  • Enabling Metadata Exchange

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
     
    ADVERTISEMENT

    Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!

    Using Service Templates with Indigo
    (Page 1 of 4 )

    In this sixth part of a ten-part series on the Windows Communication Foundation (WCF), aka Indigo, you'll learn how to work with service templates. This article is excerpted from chapter 1 of the book Learning WCF A Hands-on Guide, written by Michele Leroux Bustamante (O'Reilly, 2007; ISBN: 0596101627). Copyright © 2007 O'Reilly Media, Inc. All rights reserved. Used with permission from the publisher. Available from booksellers or direct from O'Reilly Media.

    Service Templates

    This lab introduces several Visual Studio templates for generating service code. In an existing project--no matter whether it is a class library, console application, Windows application, or web site--you can add a new WCF Service. This template generates a sample service contract and service type to get you started. If you add the WCF Service to an executable project, the template also supplies a helper class for hosting the service. When you want to create a class library for your services, you can create a WCF Service Library project. This template creates a new class library, including a sample service contract and service type. In this case, the assumption is that you'll create a separate host for the service (my personal preference). Using each of these templates also adds the appropriate service model assembly references to save you the trouble.

    Service templates for web sites are slightly different from other projects because the hosting environment is slightly different. The overall result is the same--sample code is generated and assembly references are added. The difference is that an additional file is generated with a .svc extension for web hosting. You'll see this in the next lab.

    ServiceModel Metadata Utility

    The ServiceModel Metadata Utility is a command-line tool that is installed with the Windows SDK for .NET 3.0--an executable file named svcutil.exe. This tool can be used for two key purposes:

    1. To generate code and configuration settings from metadata
    2. To generate metadata from code and configuration

    With SvcUtil you can export and import metadata, validate services, and manipulate how types are generated and shared between services and clients. Add Service Reference uses SvcUtil to generate proxies and configuration, but from the command line, you can exercise greater control over this process.

    This lab illustrates a very simple command-line instruction for generating a proxy and configuration file from a metadata exchange endpoint as follows:

      svcutil /d:<YourLearningWCFPath>\Labs\ Chapter1\HelloIndigo\Client  /o:serviceproxy.cs
      /config:app.config http://localhost:8000/HelloIndigo

    You can also suppress the generation of configuration output with the following instruction:

      svcutil /d:<YourLearningWCFPath>\Labs\ Chapter1\HelloIndigo\Client  /o:serviceproxy.cs
      /config:noconfig http://localhost:8000/HelloIndigo

    To see all the options for SvcUtil, from the command line you can type:

      svcutil /?

    Using Add Service Reference to generate the client configuration and proxy will work for many cases, but there are some cases in which you need to exercise control over things such as how arrays are handled, to make asynchronous calls to the proxy, and to share types with the service. I'll explore other uses for SvcUtil throughout this book.

    More BrainDump Articles
    More By O'Reilly Media


       · This article is an excerpt from the book "Learning WCF A Hands-on Guide," published...
     

    Buy this book now. This article is excerpted from chapter 1 of the book Learning WCF A Hands-on Guide, written by Michele Leroux Bustamante (O'Reilly, 2007; ISBN: 0596101627). Check it out today at your favorite bookstore. Buy this book now.

    BRAINDUMP ARTICLES

    - Multiple Service Contracts and Indigo
    - Cleaning Out Your Programs in XP
    - Handling Metadata with Indigo
    - Building Blocks for a WCF Service Web Site
    - Help! I Need Some Remote Assistance
    - Using Service Templates with Indigo
    - Windows XP Tips for Task Manager
    - Generating Clients and Services with Indigo
    - Vista SP1, A Review
    - Services and the WCF
    - VBScript: Final Date Functions
    - Creating Services with the WCF
    - The Resource View of the MFC
    - VBScript: More Fun with the Date Functions
    - Vista Price Cuts Dissected

     
    Accelerating Trading Partner Performance
     
    Competing on Analytics
     
    Cost Effective Scaling with Virtualization and Coyote Point Systems
     
    Five Checkpoints to Implementing IP Telephony
     
    Hosted Email Security: Staying Ahead of New Threats
     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway