BrainDump
  Home arrow BrainDump arrow Using Service Templates with Indigo
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  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
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 / 2
    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


    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

    - Introduction to Office Live Workspace
    - Using MS Excel for One-way Analysis of Varia...
    - Comparing Data Sets Using Statistical Analys...
    - Import Blogger Posts into WordPress Using Wi...
    - Download WordPress from an FTP Server and Ru...
    - Install and Run WordPress in XAMPP Local Host
    - What Windows 7 Brings to the Table
    - Virtualization and Sandbox Detection
    - Advanced Firebug Techniques in Windows XP Ho...
    - Editing CSS with Firebug in Windows XP Home
    - Using Firebug in Windows XP Home
    - Migrating to Exchange Server 2007
    - Using System Restore on a Non-Bootable PC
    - Finding Logged on Users and More Scripting S...
    - Developing Macro Commands in MS Excel





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek