ASP.NET
  Home arrow ASP.NET arrow Page 2 - Developing a WCF Service Library and Hosti...
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? 
ASP.NET

Developing a WCF Service Library and Hosting it with a Custom App Using VS2K8
By: Jagadish Chaterjee
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 7
    2007-10-02

    Table of Contents:
  • Developing a WCF Service Library and Hosting it with a Custom App Using VS2K8
  • Creating a WCF Service Library
  • Creating a WCF Service Library: source code
  • Build the project
  • Testing the WCF custom hosted Service: source code

  • 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


    Developing a WCF Service Library and Hosting it with a Custom App Using VS2K8 - Creating a WCF Service Library


    (Page 2 of 5 )

    The following are the steps required to create a WCF Service Library:

    • Open Microsoft Visual Studio 2008 Beta 2

    • Go to File || New Project

    • In the "New Project" dialog box, open "Visual Basic" project types and select WCF. The respective templates for WCF will be shown on the right side.

    • Select the "WCF Service Library" template.

    • Provide  "WCFSampleService" as the name and provide the proper path as the location.

    • Make sure that ".NET Framework 3.5" is selected at the top.

    • Once everything looks like the following (fig 01), click OK.

    • Rename "IService1.vb" to "IProductService.vb."

    • Rename "Service1.vb" to "ProductService.vb."

    Creating a WCF Service Library: application configuration

    As we created a WCF Service Library (instead of a WCF Service Application), Visual Studio adds an "app.config" file (as opposed to a "web.config" file in a WCF Service Application) to the solution. Modify the "app.config" file to match the following:

    <system.serviceModel>

    <services>

    <service name="NorthwindService.ProductService"
    behaviorConfiguration="NorthwindService.ProductServiceBehavior">

    <host>

    <baseAddresses>

    <add baseAddress="http://localhost:8181/ProductService" />

    </baseAddresses>

    </host>

    <!-- Service Endpoints -->

    <!-- Unless fully qualified, address is relative to base address supplied
    above
    -->

    <endpoint address="" binding="wsHttpBinding"
    contract="NorthwindService.IProductService" />

    <!-- Metadata Endpoints -->

    <!-- The Metadata Exchange endpoint is used by the service to describe
    itself to clients.
    -->

    <!-- This endpoint does not use a secure binding and should be secured or
    removed before deployment
    -->

    <endpoint address="mex" binding="mexHttpBinding"
    contract="IMetadataExchange" />

    </service>

    </services>

    <behaviors>

    <serviceBehaviors>

    <behavior name="NorthwindService.ProductServiceBehavior">

    <!-- To avoid disclosing metadata information, set the value below to
    false and remove the metadata endpoint above before deployment
    -->

    <serviceMetadata httpGetEnabled="True"/>

    <!-- To receive exception details in faults for debugging purposes, set
    the value below to true. Set to false before deployment 
    to avoid
    disclosing exception information
    -->

    <serviceDebug includeExceptionDetailInFaults="True" />

    </behavior>

    </serviceBehaviors>

    </behaviors>

    </system.serviceModel>

    Now it is time to specify the connection string. Using Solution Explorer, right click on project and go to properties (Fig 02):

    Within the project properties, open the Settings tab and add a new setting with the name "cnNorthwind," "Type" as "String", "Scope" as "Application" and "Value" as required connection string (to connect to database) as shown below (Fig 03):

    More ASP.NET Articles
    More By Jagadish Chaterjee


       · Hi,This is my second article focusing on developing WCF Services. This...
     

    ASP.NET ARTICLES

    - Developing a Mini ASP.NET AJAX Server Centri...
    - Disadvantages of the ASP.NET MVC Framework
    - Advantages of the ASP.NET MVC Approach
    - ASP.NET Web Forms Weaknesses
    - ASP.NET Web Forms Meets ASP.NET MVC
    - Source Code for Saving and Retrieving Data w...
    - Using GridView to Save and Retrieve Data wit...
    - Handling Dynamic Images in ASP.NET 3.5 AJAX ...
    - Retrieving Data with AJAX and the GridView C...
    - Playing with Images in ASP.NET 3.5 AJAX Appl...
    - Saving and Retrieving Data with AJAX
    - Enhancing PHP Via the ASP.NET AJAX Framework...
    - Enhancing PHP Programming with the ASP.NET A...
    - Classes and ASP.NET AJAX
    - Using ASP.NET AJAX

     
    Best Practices for Windows Vista Migration Presentation
    Dell and Microsoft recently held a series of face-to-face seminars entitled, &qu....

     
    Creating a Culture for Code Reuse
    If you oversee development teams you know that like it or not proprietary and ex....

     
    Keys to Web Application Acceleration: Advances in Delivery Systems
    Accelerate Web apps by up to 5x. Ensure significantly faster access to the Web a....

     
    Optimizing Application Monitoring
    Tired of finding out from your customers that you're offline? This white paper e....

     
    Solaris to Solaris Migration -- Migrating applications from Sun SPARC to Dell PowerEdge R900
    This comprehensive Migration Guide reviews the approach that Principled Technolo....

     




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