BrainDump
  Home arrow BrainDump arrow Page 3 - 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  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
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 - ServiceHost Initialization


    (Page 3 of 4 )

    The first lab illustrates how to configure the ServiceHost programmatically. This lab illustrates how to configure the ServiceHost declaratively using the service model configuration section. But how does the ServiceHost know which configuration section to use? When the ServiceHost is opened, it reads the <services>section looking for a<service>element that matches its service type. From the lab, consider thisServiceHostconstructor:

      ServiceHost myServiceHost = new ServiceHost(typeof(HelloIndigo.HelloIndigoService));

    TheServiceHostwill look for a<service>section using the nameHelloIndigo.HelloIndigoService, as shown here:

      <service behaviorConfiguration="serviceBehavior"
     
    name="HelloIndigo.HelloIndigoService" >
       
    <host>...</host>
       
    <endpoint... />
       
    <endpoint... />
     
    </service>

    The<service>element can include base addresses and service endpoints, as shown previously in Example 1-5. You can supply a base address for any protocol so that you can expose relative service endpoints over that protocol. The following illustrates the<host>section with base addresses for HTTP, TCP, and named pipe protocols:

      <host>
       
    <baseAddresses>
         
    <add baseAddress="http://localhost:8000/HelloIndigo" />
         
    <add baseAddress="net.tcp://localhost:9000/HelloIndigo" />
         
    <add baseAddress="net.pipe://localhost/HelloIndigo" />
        </baseAddresses
    >
      </host>

    One or more<endpoint>sections may also be provided. As discussed previously, an endpoint is defined by an address, contract, and binding. If address is omitted altogether, the base address for the related binding protocol is used (and required). If the address omits the full URI, it is appended to the base address matching the binding protocol. However, you can specify a complete address that ignores the base address. The following illustrates these three choices for an endpoint configuration:

      <endpoint binding="basicHttpBinding" name="basicHttp" contract="Host.
      IHelloIndigoService" /> 
      <endpoint address="HelloIndigoService" binding="basicHttpBinding" name="basicHttp"
      contract="Host.IHelloIndigoService" />
      <endpoint address="http://localhost:8001/HelloIndigo/
    HelloIndigoService"
      binding="basicHttpBinding"  name="basicHttp" contract="Host.IHelloIndigoService" />

    Endpoints have to be unique for a particular service. When multiple endpoints are exposed by a service, they must differ in address, contract, or transport protocol.

    There are several reasons why a service may expose multiple endpoints, including the following:

    • The service implements multiple contracts, each requiring its own endpoint
    • The same or different service contracts must be accessible over multiple protocols
    • The same or different service contracts must be accessible by clients with different binding requirements, possibly related to security, reliable messaging, message size, or transactions

      These topics will be explored throughout the 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

    - Internet Explorer 8 Review
    - Nilpo`s Top Windows Add-Ons
    - Beginning Silverlight 2.0 Development using ...
    - Fixing Vista`s Troubles
    - Preparing Windows Images for Mass Deployment
    - The Trouble With Vista
    - Slipstreamed and Unattended Windows Installa...
    - Microsoft Office SharePoint Server
    - Microsoft Office SharePoint Designer
    - Microsoft Windows SharePoint Services 3.0
    - Microsoft Live Mesh Overview
    - XAML Brushes and Silverlight
    - Silverlight and XAML Basics
    - Immortal XP
    - XAML Basics





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
    Stay green...Green IT