Configure WCF service using multiple EndPoints

by Jagadish Pulakhandam on 5/10/2011 1:13:01 PM
Rated 0 from 0 votes
Brief: Demonstrates on configuring a WCF Service with multiple EndPoints from the scratch. As part of this sample, I will demonstrate on making WCF Service listen at both "BasicHttpBinding" and "NetTcpBinding"
Posted to: Windows Communication Foundation - Bindings
Add to DiggAdd to del.icio.usAdd to FURLAdd to RedditAdd to YahooAdd to BlinklistAdd to GoogleAdd to ma.gnoliaAdd to ShadowsAdd to Technorati

Demonstrates the following (see attached video):

  • Create a very basic WCF Service Library from the scratch (using Visual Studio 2010)
  • Configure WCF Service using BasicHttpBinding using "WCF Service Configuration Editor"
  • Further configure the same service using NetTcpBinding using "WCF Service Configuration Editor"
  • Execute by hosting through "WCF Service Host" (which should make both EndPoints consumable).
  • Test the service using "WCF Test Client"
Source code is provided in previous article.  Configuration needs to be modified as shown below:

01.<?xml version="1.0" encoding="utf-8" ?>
02.<configuration>
03. 
04.  <system.web>
05.    <compilation debug="true" />
06.  </system.web>
07. 
08. 
09.  <system.serviceModel>
10.    <behaviors>
11.      <serviceBehaviors>
12.        <behavior name="SampleSvcBehavior">
13.          <serviceDebug includeExceptionDetailInFaults="true" />
14.          <serviceMetadata httpGetEnabled="true" />
15.        </behavior>
16.      </serviceBehaviors>
17.    </behaviors>
18.    <services>
19.      <service behaviorConfiguration="SampleSvcBehavior" name="SampleCalcSvc.CalcService">
20.        <endpoint address="" binding="basicHttpBinding" bindingConfiguration=""
21.          name="SampleSvcBasicHttpEndPoint" contract="SampleCalcSvc.ICalcService" />
22.        <endpoint address="mex" binding="mexHttpBinding" bindingConfiguration=""
23.          name="SampleSvcMexHttpEndPoint" contract="IMetadataExchange" />
24.        <endpoint binding="netTcpBinding" bindingConfiguration="" name="SampleSvcTcpEndPoint"
25.          contract="SampleCalcSvc.ICalcService" />
26.        <host>
27.          <baseAddresses>
28.            <add baseAddress="http://localhost:8080/SampleSvc" />
29.            <add baseAddress="net.tcp://localhost:8181/SampleSvc" />
30.          </baseAddresses>
31.        </host>
32.      </service>
33.    </services>
34.  </system.serviceModel>
35.</configuration>


Join the .NET Code Central Community and join the discussion!
Signing-up is FREE and quick. Do it now, we want to hear your opinion
0

Rated 0 from 0 votes ( login  to rate)
DotnetKicks DotnetKicksDe DotNetShoutout

Attachments / Source Code
You need to Login or Join for FREE to download the following

Video/Screen Recording (may not have audio narration/annotations)
You need to Login or Join for FREE to download the following