SlideShare a Scribd company logo
WCF - In a Week
Name:   Gnana Arun GaneshTitle: MVPhttp://arunmvp.blogspot.com/www.mugh.netWhat’s new in WCF4.0?
AgendaWhat’s new in WCF4.0?Simplified ConfigurationRouting ServiceREST ImprovementsDiscovery
WCF in a SlideOne-stop-shop for servicesConsistent object modelGreat “ility” features1st released with .NET Framework 3.0Single programming model that can be used for various kinds of communication
WCF GoalsUnificationUnification of Microsoft’s Distributed Computing Technologies
WCF GoalsInteroperability
ABC’s of ServiceWCF SERVICEAddress: Where is the service? Binding: How do I communicate to the service?Contract: What can the service do for me? Endpoints: Addresses, Bindings, and Contracts!
ABC’s of ServiceBindings ship with WCF
View It and Do Itdemo Basic DemoSelf Host
Tool ImprovementsProductivity BreakthroughsAutomatically generated WCF clientThe ChallengeCreating and maintaining a test client for WCF services is time consuming and tedious.The SolutionVisual Studio 2008 includes a feature that inspects a WCF service and automatically generates a client for it. Because this client is automatically generated each time, it is always up to date.This client tools supports complex service contracts, so it is practical for even the most demanding WCF services.
Tool ImprovementsProductivity BreakthroughsWCF Performance ProfilingThe ChallengeServices are often created to be used in very demanding, high-traffic environments.The SolutionVisual Studio 2008 has been enhanced to include profiling WCF applications. Using this profiler, developers can pin point performance bottlenecks in their crucial services before they ever leave the development phase.
New WCF Feature Areas in .NET 4
Endpoint Configuration in 3.xhttp://hostServicevdir1vdir2ABCvdir2Echo.svcWeb.config
Default Endpointshttp://hostServiceHost.AddDefaultEndpoints()Servicevdir1vdir2ABCvdir2Echo.svcEcho.svcProtocol Mapping
Protocol Mappings: Default bindingsYou can now specify your default binding per scheme <system.serviceModel>    <protocolMapping>	<add scheme="http" binding="wsHttpBinding" />    </protocolMapping>…DEFAULT:<protocolMapping>            <add scheme="http" binding="basicHttpBinding"/>            <add scheme="net.tcp" binding="netTcpBinding"/>            <add scheme="net.pipe" binding="netNamedPipeBinding"/>            <add scheme="net.msmq“ binding="netMsmqBinding"/> </protocolMapping>
Simplified IIS/ASP.NET hosting (?!)<!-- HelloWorld.svc --> <%@ ServiceHost Language="C#" Debug="true" Service="HelloWorldService"CodeBehind="~/App_Code/HelloWorldService.cs" %>  [ServiceContract]  public class HelloWorldService  {     [OperationContract]     public string HelloWorld()     {         return "hello, world";     }  }
WCF – Building RESTful servicesREST/URI/HTTP VerbsREST defines an architectural style based on a set of constraints for building things the “Web” way. URI / Segment of a URI map to Application LogicHTTP GET – View It OperationsHTTP <Other> - Do it operations
Who Cares?REST/URI/HTTP VerbsWeb == Reach
The Services EcosystemREST/URI/HTTP VerbsSOAP, WS-*, Web (or REST), SyndicationsView as part of the same ecosystemSOAP, WS-*, via WCF in .NET 3.0Web, Syndicationsvia WCF in .NET 3.5
The Web, The URI, and AppsREST/URI/HTTP Verbsamazon.com/authors/ArunGanesh/VS2010amazon.com/authors/Bob/.NET4.0amazon.com/authors/{author}/{book}amazon.com/authors/ArunGanesh?book=VS2010amazon.com/authors/Bob?book=.NET4.0amazon.com/authors/{author}?book={book}
webHttpBindingNew “web-friendly” WCF Binding in Fx 3.5Allows for the development of RESTful servicesDoes not use SOAP envelopesHTTP and HTTPS Transports OnlySupports several wire formats:XMLJSONBinary (streams)REST/URI/HTTP Verbs
View It and Do Itdemo URIREST – HTTPVerbs
REST improvementsAutomatic Help Page<behaviors>  <endpointBehaviors>      <behavior name=“HelpBehavior”>         <webHttphelpEnabled=“true” />      </behavior>   </endpointBehavior></behaviors>
Generated Help Page
REST ImprovementsHTTP Caching<system.web> <caching>   <outputCacheSettings>      <outputCacheProfiles>         <add name=“PleaseCache60Secs” duration=“60” varyByParam=“format” />  … [AspNetCacheProfile(“PleaseCache60Secs”]   [WebGet(UriTemplate=XmlItemTemplate)] [OperationContract]public Counter GetItemInXml() { …}  )
REST improvements<behaviors>  <endpointBehaviors>      <behavior name=“HelpBehavior”>         <webHttphelpEnabled=“true” />      </behavior>   </endpointBehavior></behaviors>Automatic Help PageHTTP Caching<system.web> <caching>   <outputCacheSettings>      <outputCacheProfiles>         <add name=“PleaseCache60Secs” duration=“60” varyByParam=“format” />  …
Message RoutingEchoClientRoutingServiceTimeServiceReplaceable atRuntime
Protocol BridgingClientServiceRoutingServiceBasicHttpNet.TcpSOAP 1.1SOAP 1.2
Error HandlingEchoServiceClientRoutingServiceBackupEcho Service
RoutingServicedemo
DiscoveryDescriptionRuntimeDiscovery BehaviorsDiscovery Service & ClientAnnouncement Service & ClientDiscovery ProxyDiscovery Service ExtensionEndpointsDynamic,Discovery, andAnnouncementContractsDiscovery ContractAnnouncement ContractFind CriteriaEndpoint Discovery Metadata
Discovery - Service<configuration>    <system.serviceModel>      <services>        <service name="CalculatorService">          <endpoint binding="wsHttpBinding" contract="ICalculatorService" />          <!-- add a standard UDP discovery endpoint-->          <endpoint name="udpDiscovery" kind="udpDiscoveryEndpoint"/>        </service>      </services>      <behaviors>        <serviceBehaviors>          <behavior>            <serviceDiscovery/> <!-- enable service discovery behavior -->          </behavior>        </serviceBehaviors>      </behaviors>    </system.serviceModel></configuration>
Discovery – Client - config<configuration>    <system.serviceModel>        <client>          <endpoint              name="calculatorEndpoint"              binding="wsHttpBinding"              contract="ICalculatorService">          </endpoint>          <endpoint name="udpDiscoveryEndpoint" kind="udpDiscoveryEndpoint"/>        </client>    </system.serviceModel></configuration>
Discovery – Client - code  // Create DiscoveryClientDiscoveryClientdiscoveryClient = new DiscoveryClient("udpDiscoveryEndpoint");  // Find ICalculatorService endpoints in the specified scopeFindCriteriafindCriteria = new FindCriteria(typeof(ICalculatorService));FindResponsefindResponse = discoveryClient.Find(findCriteria);  // Just pick the first discovered endpointEndpointAddress address = findResponse.Endpoints[0].Address;  // Create the target service clientCalculatorServiceClient client = new CalculatorServiceClient("calculatorEndpoint");  // Connect to the discovered service endpointclient.Endpoint.Address = address;Console.WriteLine("Invoking CalculatorService at {0}", address);  // Call the Add service operation.  double result = client.Add(value1, value2);Console.WriteLine("Add({0},{1}) = {2}", 100, 200, result);
Discoverydemo
Work flow Servicesdemo
© 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation.  Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation.  MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
View It and Do Itdemo Hosting / BehaviorsTool ImprovementsMultiple EndpointsDemos and More Demos!

More Related Content

PDF
GWT training session 3
PPT
Svcc2009 Async Ws
PPT
Esposito Ajax Remote
ODP
Creating a Java EE 7 Websocket Chat Application
PPTX
Up and Running with Angular
ODP
Building Websocket Applications with GlassFish and Grizzly
PDF
AngularJS Project Setup step-by- step guide - RapidValue Solutions
ODP
Testing RESTful Webservices using the REST-assured framework
GWT training session 3
Svcc2009 Async Ws
Esposito Ajax Remote
Creating a Java EE 7 Websocket Chat Application
Up and Running with Angular
Building Websocket Applications with GlassFish and Grizzly
AngularJS Project Setup step-by- step guide - RapidValue Solutions
Testing RESTful Webservices using the REST-assured framework

What's hot (15)

PDF
Asp.Net MVC Framework Design Pattern
PDF
Android dev 3
PDF
Introduction to AngularJS
ODP
Turmeric SOA - Security and Policy
PPT
JSON Rules Language
PDF
Design & Performance - Steve Souders at Fastly Altitude 2015
PDF
Zembly Programming Language
PDF
Comet from JavaOne 2008
PDF
Nativescript angular
PPTX
Grails Advanced
PPT
Dynamic Application Development by NodeJS ,AngularJS with OrientDB
PDF
Graphql, REST and Apollo
PDF
VCL template abstraction model and automated deployments to Fastly
PPTX
Solving anything in VCL
PPT
Test strategy for web development
Asp.Net MVC Framework Design Pattern
Android dev 3
Introduction to AngularJS
Turmeric SOA - Security and Policy
JSON Rules Language
Design & Performance - Steve Souders at Fastly Altitude 2015
Zembly Programming Language
Comet from JavaOne 2008
Nativescript angular
Grails Advanced
Dynamic Application Development by NodeJS ,AngularJS with OrientDB
Graphql, REST and Apollo
VCL template abstraction model and automated deployments to Fastly
Solving anything in VCL
Test strategy for web development
Ad

Viewers also liked (17)

PPTX
Internal Controls Overview
PDF
Soal try out fisika alumni 12 okt 2014
PPTX
Auction presentation
PDF
Protocol alianta pnl pc
PPTX
Πρόταση μιας στρατηγικής για αρχαιολογικό τουρισμό για το Νομό Δράμας
PPT
Adhd&storytellling 09092014
PPT
Hostility bg 18.02.2009
PPTX
Intro Payroll
PPT
Grupi deca sop SU 07062014 sv.velkova
PDF
Geoplans
PPTX
Конфаймент и мотивация
PPTX
บทที่ 11 การส่งเสริมการขาย (2)
PPT
Igri ld children rc 02112012
PPT
Oportunitati si pasii necesari pentru a studia in strainatate
PPTX
Kinect sdk사용하기
Internal Controls Overview
Soal try out fisika alumni 12 okt 2014
Auction presentation
Protocol alianta pnl pc
Πρόταση μιας στρατηγικής για αρχαιολογικό τουρισμό για το Νομό Δράμας
Adhd&storytellling 09092014
Hostility bg 18.02.2009
Intro Payroll
Grupi deca sop SU 07062014 sv.velkova
Geoplans
Конфаймент и мотивация
บทที่ 11 การส่งเสริมการขาย (2)
Igri ld children rc 02112012
Oportunitati si pasii necesari pentru a studia in strainatate
Kinect sdk사용하기
Ad

Similar to WCF - In a Week (20)

PPT
WCF 4.0
PPT
Introduction To ASP.NET MVC
PPT
Introduction to ASP.NET MVC
PPT
Introduction to ASP.NET MVC
PPT
Session12 J2ME Generic Connection Framework
PPT
Data Access Mobile Devices
PDF
Service Oriented Integration With ServiceMix
ODP
jBPM5 in action - a quickstart for developers
PPT
Business Process Execution Language
PPT
ASP.NET MVC introduction
PPT
CGI Presentation
PDF
What's Coming in Spring 3.0
PDF
[drupalday2017] - Drupal come frontend che consuma servizi: HTTP Client Manager
PPTX
Moving applications to the cloud
PDF
twMVC#46 一探 C# 11 與 .NET 7 的神奇
ODP
Improving code quality using CI
PPTX
Communication Protocols And Web Services
PPTX
Developing ASP.NET Applications Using the Model View Controller Pattern
PPTX
#CNX14 - Dive Deep into the ExactTarget Fuel APIs
PPTX
06 web api
WCF 4.0
Introduction To ASP.NET MVC
Introduction to ASP.NET MVC
Introduction to ASP.NET MVC
Session12 J2ME Generic Connection Framework
Data Access Mobile Devices
Service Oriented Integration With ServiceMix
jBPM5 in action - a quickstart for developers
Business Process Execution Language
ASP.NET MVC introduction
CGI Presentation
What's Coming in Spring 3.0
[drupalday2017] - Drupal come frontend che consuma servizi: HTTP Client Manager
Moving applications to the cloud
twMVC#46 一探 C# 11 與 .NET 7 的神奇
Improving code quality using CI
Communication Protocols And Web Services
Developing ASP.NET Applications Using the Model View Controller Pattern
#CNX14 - Dive Deep into the ExactTarget Fuel APIs
06 web api

Recently uploaded (20)

PDF
NewMind AI Monthly Chronicles - July 2025
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Machine learning based COVID-19 study performance prediction
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Approach and Philosophy of On baking technology
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Cloud computing and distributed systems.
PPT
Teaching material agriculture food technology
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Advanced Soft Computing BINUS July 2025.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
NewMind AI Monthly Chronicles - July 2025
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
CIFDAQ's Market Insight: SEC Turns Pro Crypto
NewMind AI Weekly Chronicles - August'25 Week I
Mobile App Security Testing_ A Comprehensive Guide.pdf
Machine learning based COVID-19 study performance prediction
Reach Out and Touch Someone: Haptics and Empathic Computing
Approach and Philosophy of On baking technology
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
The Rise and Fall of 3GPP – Time for a Sabbatical?
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Dropbox Q2 2025 Financial Results & Investor Presentation
Network Security Unit 5.pdf for BCA BBA.
Cloud computing and distributed systems.
Teaching material agriculture food technology
20250228 LYD VKU AI Blended-Learning.pptx
Advanced Soft Computing BINUS July 2025.pdf
The AUB Centre for AI in Media Proposal.docx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf

WCF - In a Week

  • 2. Name: Gnana Arun GaneshTitle: MVPhttp://arunmvp.blogspot.com/www.mugh.netWhat’s new in WCF4.0?
  • 3. AgendaWhat’s new in WCF4.0?Simplified ConfigurationRouting ServiceREST ImprovementsDiscovery
  • 4. WCF in a SlideOne-stop-shop for servicesConsistent object modelGreat “ility” features1st released with .NET Framework 3.0Single programming model that can be used for various kinds of communication
  • 5. WCF GoalsUnificationUnification of Microsoft’s Distributed Computing Technologies
  • 7. ABC’s of ServiceWCF SERVICEAddress: Where is the service? Binding: How do I communicate to the service?Contract: What can the service do for me? Endpoints: Addresses, Bindings, and Contracts!
  • 9. View It and Do Itdemo Basic DemoSelf Host
  • 10. Tool ImprovementsProductivity BreakthroughsAutomatically generated WCF clientThe ChallengeCreating and maintaining a test client for WCF services is time consuming and tedious.The SolutionVisual Studio 2008 includes a feature that inspects a WCF service and automatically generates a client for it. Because this client is automatically generated each time, it is always up to date.This client tools supports complex service contracts, so it is practical for even the most demanding WCF services.
  • 11. Tool ImprovementsProductivity BreakthroughsWCF Performance ProfilingThe ChallengeServices are often created to be used in very demanding, high-traffic environments.The SolutionVisual Studio 2008 has been enhanced to include profiling WCF applications. Using this profiler, developers can pin point performance bottlenecks in their crucial services before they ever leave the development phase.
  • 12. New WCF Feature Areas in .NET 4
  • 13. Endpoint Configuration in 3.xhttp://hostServicevdir1vdir2ABCvdir2Echo.svcWeb.config
  • 15. Protocol Mappings: Default bindingsYou can now specify your default binding per scheme <system.serviceModel> <protocolMapping> <add scheme="http" binding="wsHttpBinding" /> </protocolMapping>…DEFAULT:<protocolMapping>         <add scheme="http" binding="basicHttpBinding"/>         <add scheme="net.tcp" binding="netTcpBinding"/>         <add scheme="net.pipe" binding="netNamedPipeBinding"/>         <add scheme="net.msmq“ binding="netMsmqBinding"/> </protocolMapping>
  • 16. Simplified IIS/ASP.NET hosting (?!)<!-- HelloWorld.svc --> <%@ ServiceHost Language="C#" Debug="true" Service="HelloWorldService"CodeBehind="~/App_Code/HelloWorldService.cs" %> [ServiceContract] public class HelloWorldService { [OperationContract] public string HelloWorld() { return "hello, world"; } }
  • 17. WCF – Building RESTful servicesREST/URI/HTTP VerbsREST defines an architectural style based on a set of constraints for building things the “Web” way. URI / Segment of a URI map to Application LogicHTTP GET – View It OperationsHTTP <Other> - Do it operations
  • 19. The Services EcosystemREST/URI/HTTP VerbsSOAP, WS-*, Web (or REST), SyndicationsView as part of the same ecosystemSOAP, WS-*, via WCF in .NET 3.0Web, Syndicationsvia WCF in .NET 3.5
  • 20. The Web, The URI, and AppsREST/URI/HTTP Verbsamazon.com/authors/ArunGanesh/VS2010amazon.com/authors/Bob/.NET4.0amazon.com/authors/{author}/{book}amazon.com/authors/ArunGanesh?book=VS2010amazon.com/authors/Bob?book=.NET4.0amazon.com/authors/{author}?book={book}
  • 21. webHttpBindingNew “web-friendly” WCF Binding in Fx 3.5Allows for the development of RESTful servicesDoes not use SOAP envelopesHTTP and HTTPS Transports OnlySupports several wire formats:XMLJSONBinary (streams)REST/URI/HTTP Verbs
  • 22. View It and Do Itdemo URIREST – HTTPVerbs
  • 23. REST improvementsAutomatic Help Page<behaviors> <endpointBehaviors> <behavior name=“HelpBehavior”> <webHttphelpEnabled=“true” /> </behavior> </endpointBehavior></behaviors>
  • 25. REST ImprovementsHTTP Caching<system.web> <caching> <outputCacheSettings> <outputCacheProfiles> <add name=“PleaseCache60Secs” duration=“60” varyByParam=“format” /> … [AspNetCacheProfile(“PleaseCache60Secs”] [WebGet(UriTemplate=XmlItemTemplate)] [OperationContract]public Counter GetItemInXml() { …} )
  • 26. REST improvements<behaviors> <endpointBehaviors> <behavior name=“HelpBehavior”> <webHttphelpEnabled=“true” /> </behavior> </endpointBehavior></behaviors>Automatic Help PageHTTP Caching<system.web> <caching> <outputCacheSettings> <outputCacheProfiles> <add name=“PleaseCache60Secs” duration=“60” varyByParam=“format” /> …
  • 31. DiscoveryDescriptionRuntimeDiscovery BehaviorsDiscovery Service & ClientAnnouncement Service & ClientDiscovery ProxyDiscovery Service ExtensionEndpointsDynamic,Discovery, andAnnouncementContractsDiscovery ContractAnnouncement ContractFind CriteriaEndpoint Discovery Metadata
  • 32. Discovery - Service<configuration> <system.serviceModel> <services> <service name="CalculatorService"> <endpoint binding="wsHttpBinding" contract="ICalculatorService" /> <!-- add a standard UDP discovery endpoint--> <endpoint name="udpDiscovery" kind="udpDiscoveryEndpoint"/> </service> </services> <behaviors> <serviceBehaviors> <behavior> <serviceDiscovery/> <!-- enable service discovery behavior --> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel></configuration>
  • 33. Discovery – Client - config<configuration> <system.serviceModel> <client> <endpoint name="calculatorEndpoint" binding="wsHttpBinding" contract="ICalculatorService"> </endpoint> <endpoint name="udpDiscoveryEndpoint" kind="udpDiscoveryEndpoint"/> </client> </system.serviceModel></configuration>
  • 34. Discovery – Client - code // Create DiscoveryClientDiscoveryClientdiscoveryClient = new DiscoveryClient("udpDiscoveryEndpoint"); // Find ICalculatorService endpoints in the specified scopeFindCriteriafindCriteria = new FindCriteria(typeof(ICalculatorService));FindResponsefindResponse = discoveryClient.Find(findCriteria); // Just pick the first discovered endpointEndpointAddress address = findResponse.Endpoints[0].Address; // Create the target service clientCalculatorServiceClient client = new CalculatorServiceClient("calculatorEndpoint"); // Connect to the discovered service endpointclient.Endpoint.Address = address;Console.WriteLine("Invoking CalculatorService at {0}", address); // Call the Add service operation. double result = client.Add(value1, value2);Console.WriteLine("Add({0},{1}) = {2}", 100, 200, result);
  • 37. © 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
  • 38. View It and Do Itdemo Hosting / BehaviorsTool ImprovementsMultiple EndpointsDemos and More Demos!