SlideShare a Scribd company logo
Microsoft .Net Framework 3.x The Windows Communication Foundation
Agenda .Net 3.x The WCF- Developers perspective The WCF Architecture ABC … Fault Tolerance Demos / Hands on Questions and Answers
.Net 3.0:  Net combines the power of the .NET Framework 2.0 with new technologies for building applications that have visually compelling user experiences, seamless communication across technology boundaries, and the ability to support a wide range of business processes. NET Framework 3.0 is a superset of the .NET Framework, designed to expose the new functionality in Windows Vista® to the developer through managed classes. Overview to .Net 3.0 Windows Vista (Longhorn) is tightly integrated with .net 3.0 framework. The Look and feel of Vista is enhanced using the WPF.
What's new in .Net 3.0 – A developer perspective  Programming model for Windows   .NET Framework 3.0 consists of these basic components: .NET Framework 2.0 Microsoft® Windows® Presentation Foundation (formerly Avalon) Microsoft® Windows® Communication Foundation (formerly Indigo) Microsoft® Windows® Workflow Foundation Windows CardSpace® (formerly code named "Infocard")
Windows Communication Foundation The WCF is an incremental, evolutionary technology that brings all the formerly distinct and separate Microsoft connectivity technologies together under a single umbrella within the System.ServiceModel namespace. Included in WCF are Web services (ASMX), the Web service Extensions (WS*), Microsoft Message Queuing (MSMQ), Enterprise Services, COM+, and .NET Remoting using Windows Communication Foundation's System.ServiceModel namespace  Having a single namespace that subsumes all of these into a coherent package is enormously useful, and makes designing, developing, and deploying applications that require connectivity far simpler. Whether the application connects via loosely coupled Web services, or tightly coupled Enterprise Services, the coding model will be consistent and the transition between different communication types will be smoother
WCF in a Nutshell Three main design goals of WCF are: Unification of existing technologies   Interoperability across platforms   Service-oriented development   WCF offers immensely valuable support for reliability, transactions, concurrency management, security, and instance activation WCF comes with a unified programming model providing: A single API for building connected systems   Built-in support for a broad set of web service protocols   Implicit use of service-oriented development principles   WCF native messaging protocol is SOAP, which as an open standard provides the opportunity for the WCF service to interact with different technologies running on different platforms and non-Windows operating systems.   It also can exist peacefully with its predecessors such as COM+ and Enterprise Services
WCF in a Nutshell
WCF in a Nutshell The WCF stack maps almost on a one-to-one basis to all the SOA principles
WCF Communication With WCF, the client never interacts with the service directly, even when dealing with a local, in-memory service. Instead, the client always uses a proxy to forward the call to the service. The proxy exposes the same operations as the service, plus some proxy-management methods. Same-machine communication  Cross-machine   communication
The WCF architecture
WCF
WCF – Contracts Contracts and Descriptions Contracts define various aspects of the message system.  The contract is a platform-neutral and standard way of describing what the service does. WCF defines four types of contracts. Service Contracts - Describes the operations a service can perform. Maps CLR types to WSDL.  Data Contracts - Describes a data structure.  WCF defines implicit contracts for built-in types such as int and strin g. Maps CLR types to XSD.  Message Contracts - Defines the structure of the message on the wire.  Message contracts can be typed or untyped, and are useful in interoperability cases and when there is an existing message format to comply with.  Maps CLR types to SOAP messages.  Fault contracts  -  Define which errors are raised by the service, and how the service handles and propagates errors to its clients.
WCF Service Runtime The service runtime layer contains the behaviors that occur only during the actual operation of the service, that is, the runtime behaviors of the service.  Throttling controls how many messages are processed, which can be varied if the demand for the service grows to a preset limit.  An error behavior specifies what occurs when an internal error occurs on the service, for example, by controlling what information is communicated to the client.  Metadata behavior governs how and whether metadata is made available to the outside world.  Instance behavior specifies how many instances of the service can be run (for example, a singleton specifies only one instance to process all messages).  Transaction behavior enables the rollback of transacted operations if a failure occurs. Dispatch behavior is the control of how a message is processed by the WCF infrastructure. Extensibility enables customization of runtime processes. For example, message inspection is the facility to inspect parts of a message, and parameter filtering enables preset actions to occur based on filters acting on message headers.
The ABC of WCF
The ABC of WCF ABC means that writing (and configuring) a WCF service is always a three-step process Define a contract and implement it on a service  Choose or define a service binding that selects a transport along with quality of service, security and other options  Deploy an endpoint for the contract by binding it (using the binding definition, hence the name) to a network address.  Every service is associated with an address that defines where the service is, a binding that defines how to communicate with the service, and a contract that defines what the service does. "A" stands for Address—as expressed in the wsdl:service section and links wsdl:binding to a concrete service endpoint address.  "B" stands for Binding—as expressed in the wsdl:binding section and binds a wsdl:portType contract description to a concrete transport, an envelope format and associated policies.  "C" stands for Contract—as expressed in the wsdl:portType, wsdl:message and wsdl:type sections and describes types, messages, message exchange patterns and operations.
WCF Endpoints - All communications with the WCF service will happen via the endpoints. The endpoint is composed of 3 parts (collectively called as ABC's of endpoint) as defines below:  Address: The endpoints specify a Address that defines where the endpoint is hosted. Contract: The endpoints specify a Contract that defines which methods of the Service class will be accessible via the endpoint; each endpoint may expose a different set of methods.  Binding: The endpoints also define a binding that specifies how a client will communicate with the service and the address where the endpoint is hosted.Various components of the WCF are depicted in the figure below.
WCF-Address In WCF, every service is associated with a unique address. The address provides two important elements: the location of the service and the transport protocol or transport schema used to communicate with the service . Provides information on WHERE the service endpoint is. scheme://<machinename>[:port]/path1/path2   WCF supports the following transport schemas: HTTP TCP Peer network IPC (Inter-Process Communication over named pipes) MSMQ http://localhost:8001  http://localhost:8001/MyService  net.tcp://localhost:8002/MyService  net.pipe://localhost/MyPipe  net.msmq://localhost/private/MyService  net.msmq://localhost/MyService
WCF-Binding A binding  provides  a consistent, canned set of choices regarding the transport protocol, message encoding, communication pattern, reliability, security, transaction propagation, and interoperability.  The service publishes its choice of binding in its metadata, enabling clients to query for the type and specific properties of the binding because the client must use the exact same binding values as the service. A single service can support multiple bindings on separate addresses. The binding controls the following: ·   The transport (HTTP, MSMQ, Named Pipes, TCP) ·   The channels (one-way, duplex, request-reply) ·   The encoding (XML, binary, MTOM…) ·   The supported WS-* protocols (WS-Security, WS-Federation, WS-Reliability, WS-Transactions)
WCF-Binding Binding  Configuration  Security  Default Session  Transactions  Duplex  basicHttpBinding  Basic Profile 1.1  None  No      wsHttpBinding  WS  Message  Optional  Yes    wsDualHttpBinding  WS  Message  Yes  Yes  Yes  wsFederationHttpBinding  WS-Federation  Message  Yes  Yes  No  netTcpBinding  .NET  Transport  Optional  Yes  Yes  netNamedPipeBinding  .NET  Transport  Yes  Yes  Yes  netMsmqBinding  .NET  Transport  Yes  Yes  No  netPeerTcpBinding  Peer  Transport      Yes  msmqIntegrationBinding  MSMQ  Transport  Yes  Yes   
WCF-Choosing a Binding
WCF – Fault Tolerance In raw .NET programming, any unhandled exception immediately terminates the process it took place in. That is not the WCF behaviour, however.  If a service call on behalf of one client causes an exception, it must not be allowed to take down the hosting process. Other clients accessing the service, or other services hosted by the same process, should not be affected.  As a result, when an unhandled exception leaves the service scope, the dispatcher silently catches and handles it by serializing it in the returned message to the client. When the returned message reaches the proxy, the proxy throws an exception on the client side. T he service should throw an instance of the FaultException<T> class [FaultContract(typeof(DivideByZeroException))]  double Divide(double number1,double number2); //More methods
WCF - Looking ahead SOAP and WS-* and the enterprise Web (or REST), the enterprise, and the rest XML SOAP WS-* Web WCF in .NET Fx 3.0 WCF in .NET Fx 3.5 (Orcas) Rss & Atom
A Performance Comparison of WCF with Existing Distributed Communication Technologies ASP.NET Web Services (ASMX) : WCF is 25%—50% faster than ASP.NET Web Services Web Services Enhancements (WSE) : The throughput of WCF is nearly 4 times better than WSE. The main reason for this is that WSE uses the System.Xml.XmlDocument class to do message level parsing, thereby loading the full message into memory at once, while WCF uses a streaming System.Xml.XmlReader class that improves the performance significantly  .NET Enterprise Services (ES) : .NET Enterprise Service is load dependant, as in one case WCF is nearly 100% faster but in another scenario it is nearly 25% slower.  .NET Remoting: approximately 25% faster than .NET Remoting  http://msdn2.microsoft.com/en-us/library/bb310550.aspx
DEMO-WCF Hello world Using svcutil Logging and debugging Multiple hosting environments Using VS2005 to generate proxy Fault Tolerance Web WCF Service Atom / RSS WCF Service Hosting WF in Service
Q & A How are messages dispatched to an object? How is the lifetime of that object controlled? How does WCF work? How do I extend WCF? How do I control the threading model?
Summary [ServiceContract] public interface IMyInterface { [FaultContract(typeof(MyFault)] [OperationContract] public void MyMethod(MyDataContract); } [ServiceBehavior(InstanceContextMode=Single] public class MyService: IMyInterface { public void MyMethod(MyDataContract){…} } <service> <endpoint name=“MyService” address=“MyAddress”   binding=“netTcpBinding” contract=“IMyInterface” /> Address + Binding  + Contract =  Endpoint Service Contract Definition Service Type [DataContract] public class MyDataContract { [DataMember] public string MyField;  } Data Contract Definition
References http://msdn2.microsoft.com/en-us/netframework/default.aspx http://www. gotdotnet .com/ Email:  [email_address] Blog:  Downloads @ blog
Questions and Answers

More Related Content

PPT
Dot Net Training Dot Net35
PPT
Silverlight Training
PPT
Web services, WCF services and Multi Threading with Windows Forms
PPTX
1. WCF Services - Exam 70-487
PPT
PDF
Windows Communication Foundation (WCF)
PPTX
WCF (Windows Communication Foundation)
PPTX
Windows Communication Foundation (WCF) Service
Dot Net Training Dot Net35
Silverlight Training
Web services, WCF services and Multi Threading with Windows Forms
1. WCF Services - Exam 70-487
Windows Communication Foundation (WCF)
WCF (Windows Communication Foundation)
Windows Communication Foundation (WCF) Service

What's hot (20)

PPT
PDF
Wcf development
DOC
WCF tutorial
PPTX
Advancio, Inc. Academy: Web Sevices, WCF & SOAPUI
PPTX
WCF Fundamentals
PPT
Interoperability and Windows Communication Foundation (WCF) Overview
PDF
Bn1001 demo ppt advance dot net
PPTX
Windows Communication Foundation (WCF)
PPTX
10 Tricks and Tips for WCF
PPT
WCF And ASMX Web Services
PPTX
Windows Communication Foundation (WCF) Best Practices
PDF
Chapter 6-Remoting
PPTX
WCF Introduction
PPT
Wcf architecture overview
PPTX
MSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for Developers
PPT
As Pdotnet
PPTX
Introduction to WCF
PDF
Building RESTful Services with WCF 4.0
DOCX
Online advertising management system
Wcf development
WCF tutorial
Advancio, Inc. Academy: Web Sevices, WCF & SOAPUI
WCF Fundamentals
Interoperability and Windows Communication Foundation (WCF) Overview
Bn1001 demo ppt advance dot net
Windows Communication Foundation (WCF)
10 Tricks and Tips for WCF
WCF And ASMX Web Services
Windows Communication Foundation (WCF) Best Practices
Chapter 6-Remoting
WCF Introduction
Wcf architecture overview
MSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for Developers
As Pdotnet
Introduction to WCF
Building RESTful Services with WCF 4.0
Online advertising management system
Ad

Similar to Dot Net Training Wcf Dot Net35 (20)

PPT
WCFPresentation.ppt WCFPresentation.ppt WCFPresentation.ppt
DOCX
Top wcf interview questions
PPT
Basics of WCF and its Security
PPTX
WCjffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff...
PPS
WCF (Windows Communication Foundation_Unit_01)
PPTX
Understanding Web Services by software outsourcing company india
PDF
Advantage of WCF Over Web Services
PDF
WCF Interview Questions By Scholarhat PDF
PPT
Session 1 Shanon Richards-Exposing Data Using WCF
PPTX
Windows Communication Foundation
PPTX
SOA & WCF
PPTX
Web programming
PPTX
web programming
PDF
Wcf faq
PPT
Java web services
PPTX
Complete Architecture and Development Guide To Windows Communication Foundati...
PPTX
WCF for begineers
PPTX
Semantic Web Services (Standards, Monitoring, Testing and Security)
PPTX
Wcf and its features
PPT
Tulsa Tech Fest2008 Service Oriented Development With Windows Communication F...
WCFPresentation.ppt WCFPresentation.ppt WCFPresentation.ppt
Top wcf interview questions
Basics of WCF and its Security
WCjffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff...
WCF (Windows Communication Foundation_Unit_01)
Understanding Web Services by software outsourcing company india
Advantage of WCF Over Web Services
WCF Interview Questions By Scholarhat PDF
Session 1 Shanon Richards-Exposing Data Using WCF
Windows Communication Foundation
SOA & WCF
Web programming
web programming
Wcf faq
Java web services
Complete Architecture and Development Guide To Windows Communication Foundati...
WCF for begineers
Semantic Web Services (Standards, Monitoring, Testing and Security)
Wcf and its features
Tulsa Tech Fest2008 Service Oriented Development With Windows Communication F...
Ad

More from Subodh Pushpak (19)

PPTX
Azure data platform & structured storage
PPTX
Xamarin day10 - Advance concepts - Native Binding, service calling
PPTX
Xamarin day9 - Advance Xamarin Forms
PPTX
Xamarin day8 - Xamarin forms. Common code / controls on iOS, Android, Windows
PPTX
Xamarin day7
PPTX
Xamarin day6 - Using SQlite on iOS, Android, Widows Phone, WinRT
PPTX
Xamarin day5 - iOS Advance Concepts
PPTX
Xamarin day4 - iOS concepts
PPTX
Xamarin day3 - Android Fragments
PPTX
Xamarin day2 - Android with Xamarin
PPTX
Xamarin day1
PPTX
New features in .NET 4.5, C# and VS2012
PPTX
Windows Azure with ASP .Net MVC3
PPTX
Windows Azure with Windows Phone 7
PPTX
Windows Phone 7- From idea to making money
PPTX
WebMatrix2
PPTX
WebMatrix
PPTX
Windows phone7 subodh
PPT
Silver Light for every one by Subodh
Azure data platform & structured storage
Xamarin day10 - Advance concepts - Native Binding, service calling
Xamarin day9 - Advance Xamarin Forms
Xamarin day8 - Xamarin forms. Common code / controls on iOS, Android, Windows
Xamarin day7
Xamarin day6 - Using SQlite on iOS, Android, Widows Phone, WinRT
Xamarin day5 - iOS Advance Concepts
Xamarin day4 - iOS concepts
Xamarin day3 - Android Fragments
Xamarin day2 - Android with Xamarin
Xamarin day1
New features in .NET 4.5, C# and VS2012
Windows Azure with ASP .Net MVC3
Windows Azure with Windows Phone 7
Windows Phone 7- From idea to making money
WebMatrix2
WebMatrix
Windows phone7 subodh
Silver Light for every one by Subodh

Recently uploaded (20)

PDF
Traveri Digital Marketing Seminar 2025 by Corey and Jessica Perlman
PDF
Power and position in leadershipDOC-20250808-WA0011..pdf
PDF
Chapter 5_Foreign Exchange Market in .pdf
PDF
Nidhal Samdaie CV - International Business Consultant
PDF
Deliverable file - Regulatory guideline analysis.pdf
PPTX
CkgxkgxydkydyldylydlydyldlyddolydyoyyU2.pptx
PDF
Ôn tập tiếng anh trong kinh doanh nâng cao
PDF
BsN 7th Sem Course GridNNNNNNNN CCN.pdf
PDF
20250805_A. Stotz All Weather Strategy - Performance review July 2025.pdf
PPT
Data mining for business intelligence ch04 sharda
DOCX
unit 1 COST ACCOUNTING AND COST SHEET
DOCX
Euro SEO Services 1st 3 General Updates.docx
PDF
Laughter Yoga Basic Learning Workshop Manual
PDF
IFRS Notes in your pocket for study all the time
PPTX
Business Ethics - An introduction and its overview.pptx
PPT
Chapter four Project-Preparation material
PPTX
Belch_12e_PPT_Ch18_Accessible_university.pptx
PDF
MSPs in 10 Words - Created by US MSP Network
PPTX
ICG2025_ICG 6th steering committee 30-8-24.pptx
PDF
Types of control:Qualitative vs Quantitative
Traveri Digital Marketing Seminar 2025 by Corey and Jessica Perlman
Power and position in leadershipDOC-20250808-WA0011..pdf
Chapter 5_Foreign Exchange Market in .pdf
Nidhal Samdaie CV - International Business Consultant
Deliverable file - Regulatory guideline analysis.pdf
CkgxkgxydkydyldylydlydyldlyddolydyoyyU2.pptx
Ôn tập tiếng anh trong kinh doanh nâng cao
BsN 7th Sem Course GridNNNNNNNN CCN.pdf
20250805_A. Stotz All Weather Strategy - Performance review July 2025.pdf
Data mining for business intelligence ch04 sharda
unit 1 COST ACCOUNTING AND COST SHEET
Euro SEO Services 1st 3 General Updates.docx
Laughter Yoga Basic Learning Workshop Manual
IFRS Notes in your pocket for study all the time
Business Ethics - An introduction and its overview.pptx
Chapter four Project-Preparation material
Belch_12e_PPT_Ch18_Accessible_university.pptx
MSPs in 10 Words - Created by US MSP Network
ICG2025_ICG 6th steering committee 30-8-24.pptx
Types of control:Qualitative vs Quantitative

Dot Net Training Wcf Dot Net35

  • 1. Microsoft .Net Framework 3.x The Windows Communication Foundation
  • 2. Agenda .Net 3.x The WCF- Developers perspective The WCF Architecture ABC … Fault Tolerance Demos / Hands on Questions and Answers
  • 3. .Net 3.0: Net combines the power of the .NET Framework 2.0 with new technologies for building applications that have visually compelling user experiences, seamless communication across technology boundaries, and the ability to support a wide range of business processes. NET Framework 3.0 is a superset of the .NET Framework, designed to expose the new functionality in Windows Vista® to the developer through managed classes. Overview to .Net 3.0 Windows Vista (Longhorn) is tightly integrated with .net 3.0 framework. The Look and feel of Vista is enhanced using the WPF.
  • 4. What's new in .Net 3.0 – A developer perspective Programming model for Windows .NET Framework 3.0 consists of these basic components: .NET Framework 2.0 Microsoft® Windows® Presentation Foundation (formerly Avalon) Microsoft® Windows® Communication Foundation (formerly Indigo) Microsoft® Windows® Workflow Foundation Windows CardSpace® (formerly code named &quot;Infocard&quot;)
  • 5. Windows Communication Foundation The WCF is an incremental, evolutionary technology that brings all the formerly distinct and separate Microsoft connectivity technologies together under a single umbrella within the System.ServiceModel namespace. Included in WCF are Web services (ASMX), the Web service Extensions (WS*), Microsoft Message Queuing (MSMQ), Enterprise Services, COM+, and .NET Remoting using Windows Communication Foundation's System.ServiceModel namespace Having a single namespace that subsumes all of these into a coherent package is enormously useful, and makes designing, developing, and deploying applications that require connectivity far simpler. Whether the application connects via loosely coupled Web services, or tightly coupled Enterprise Services, the coding model will be consistent and the transition between different communication types will be smoother
  • 6. WCF in a Nutshell Three main design goals of WCF are: Unification of existing technologies Interoperability across platforms Service-oriented development WCF offers immensely valuable support for reliability, transactions, concurrency management, security, and instance activation WCF comes with a unified programming model providing: A single API for building connected systems Built-in support for a broad set of web service protocols Implicit use of service-oriented development principles WCF native messaging protocol is SOAP, which as an open standard provides the opportunity for the WCF service to interact with different technologies running on different platforms and non-Windows operating systems. It also can exist peacefully with its predecessors such as COM+ and Enterprise Services
  • 7. WCF in a Nutshell
  • 8. WCF in a Nutshell The WCF stack maps almost on a one-to-one basis to all the SOA principles
  • 9. WCF Communication With WCF, the client never interacts with the service directly, even when dealing with a local, in-memory service. Instead, the client always uses a proxy to forward the call to the service. The proxy exposes the same operations as the service, plus some proxy-management methods. Same-machine communication Cross-machine communication
  • 11. WCF
  • 12. WCF – Contracts Contracts and Descriptions Contracts define various aspects of the message system. The contract is a platform-neutral and standard way of describing what the service does. WCF defines four types of contracts. Service Contracts - Describes the operations a service can perform. Maps CLR types to WSDL. Data Contracts - Describes a data structure. WCF defines implicit contracts for built-in types such as int and strin g. Maps CLR types to XSD. Message Contracts - Defines the structure of the message on the wire. Message contracts can be typed or untyped, and are useful in interoperability cases and when there is an existing message format to comply with. Maps CLR types to SOAP messages. Fault contracts - Define which errors are raised by the service, and how the service handles and propagates errors to its clients.
  • 13. WCF Service Runtime The service runtime layer contains the behaviors that occur only during the actual operation of the service, that is, the runtime behaviors of the service. Throttling controls how many messages are processed, which can be varied if the demand for the service grows to a preset limit. An error behavior specifies what occurs when an internal error occurs on the service, for example, by controlling what information is communicated to the client. Metadata behavior governs how and whether metadata is made available to the outside world. Instance behavior specifies how many instances of the service can be run (for example, a singleton specifies only one instance to process all messages). Transaction behavior enables the rollback of transacted operations if a failure occurs. Dispatch behavior is the control of how a message is processed by the WCF infrastructure. Extensibility enables customization of runtime processes. For example, message inspection is the facility to inspect parts of a message, and parameter filtering enables preset actions to occur based on filters acting on message headers.
  • 14. The ABC of WCF
  • 15. The ABC of WCF ABC means that writing (and configuring) a WCF service is always a three-step process Define a contract and implement it on a service Choose or define a service binding that selects a transport along with quality of service, security and other options Deploy an endpoint for the contract by binding it (using the binding definition, hence the name) to a network address. Every service is associated with an address that defines where the service is, a binding that defines how to communicate with the service, and a contract that defines what the service does. &quot;A&quot; stands for Address—as expressed in the wsdl:service section and links wsdl:binding to a concrete service endpoint address. &quot;B&quot; stands for Binding—as expressed in the wsdl:binding section and binds a wsdl:portType contract description to a concrete transport, an envelope format and associated policies. &quot;C&quot; stands for Contract—as expressed in the wsdl:portType, wsdl:message and wsdl:type sections and describes types, messages, message exchange patterns and operations.
  • 16. WCF Endpoints - All communications with the WCF service will happen via the endpoints. The endpoint is composed of 3 parts (collectively called as ABC's of endpoint) as defines below: Address: The endpoints specify a Address that defines where the endpoint is hosted. Contract: The endpoints specify a Contract that defines which methods of the Service class will be accessible via the endpoint; each endpoint may expose a different set of methods. Binding: The endpoints also define a binding that specifies how a client will communicate with the service and the address where the endpoint is hosted.Various components of the WCF are depicted in the figure below.
  • 17. WCF-Address In WCF, every service is associated with a unique address. The address provides two important elements: the location of the service and the transport protocol or transport schema used to communicate with the service . Provides information on WHERE the service endpoint is. scheme://<machinename>[:port]/path1/path2 WCF supports the following transport schemas: HTTP TCP Peer network IPC (Inter-Process Communication over named pipes) MSMQ http://localhost:8001 http://localhost:8001/MyService net.tcp://localhost:8002/MyService net.pipe://localhost/MyPipe net.msmq://localhost/private/MyService net.msmq://localhost/MyService
  • 18. WCF-Binding A binding provides a consistent, canned set of choices regarding the transport protocol, message encoding, communication pattern, reliability, security, transaction propagation, and interoperability. The service publishes its choice of binding in its metadata, enabling clients to query for the type and specific properties of the binding because the client must use the exact same binding values as the service. A single service can support multiple bindings on separate addresses. The binding controls the following: ·   The transport (HTTP, MSMQ, Named Pipes, TCP) ·   The channels (one-way, duplex, request-reply) ·   The encoding (XML, binary, MTOM…) ·   The supported WS-* protocols (WS-Security, WS-Federation, WS-Reliability, WS-Transactions)
  • 19. WCF-Binding Binding Configuration Security Default Session Transactions Duplex basicHttpBinding Basic Profile 1.1 None No     wsHttpBinding WS Message Optional Yes   wsDualHttpBinding WS Message Yes Yes Yes wsFederationHttpBinding WS-Federation Message Yes Yes No netTcpBinding .NET Transport Optional Yes Yes netNamedPipeBinding .NET Transport Yes Yes Yes netMsmqBinding .NET Transport Yes Yes No netPeerTcpBinding Peer Transport     Yes msmqIntegrationBinding MSMQ Transport Yes Yes  
  • 21. WCF – Fault Tolerance In raw .NET programming, any unhandled exception immediately terminates the process it took place in. That is not the WCF behaviour, however. If a service call on behalf of one client causes an exception, it must not be allowed to take down the hosting process. Other clients accessing the service, or other services hosted by the same process, should not be affected. As a result, when an unhandled exception leaves the service scope, the dispatcher silently catches and handles it by serializing it in the returned message to the client. When the returned message reaches the proxy, the proxy throws an exception on the client side. T he service should throw an instance of the FaultException<T> class [FaultContract(typeof(DivideByZeroException))] double Divide(double number1,double number2); //More methods
  • 22. WCF - Looking ahead SOAP and WS-* and the enterprise Web (or REST), the enterprise, and the rest XML SOAP WS-* Web WCF in .NET Fx 3.0 WCF in .NET Fx 3.5 (Orcas) Rss & Atom
  • 23. A Performance Comparison of WCF with Existing Distributed Communication Technologies ASP.NET Web Services (ASMX) : WCF is 25%—50% faster than ASP.NET Web Services Web Services Enhancements (WSE) : The throughput of WCF is nearly 4 times better than WSE. The main reason for this is that WSE uses the System.Xml.XmlDocument class to do message level parsing, thereby loading the full message into memory at once, while WCF uses a streaming System.Xml.XmlReader class that improves the performance significantly .NET Enterprise Services (ES) : .NET Enterprise Service is load dependant, as in one case WCF is nearly 100% faster but in another scenario it is nearly 25% slower. .NET Remoting: approximately 25% faster than .NET Remoting http://msdn2.microsoft.com/en-us/library/bb310550.aspx
  • 24. DEMO-WCF Hello world Using svcutil Logging and debugging Multiple hosting environments Using VS2005 to generate proxy Fault Tolerance Web WCF Service Atom / RSS WCF Service Hosting WF in Service
  • 25. Q & A How are messages dispatched to an object? How is the lifetime of that object controlled? How does WCF work? How do I extend WCF? How do I control the threading model?
  • 26. Summary [ServiceContract] public interface IMyInterface { [FaultContract(typeof(MyFault)] [OperationContract] public void MyMethod(MyDataContract); } [ServiceBehavior(InstanceContextMode=Single] public class MyService: IMyInterface { public void MyMethod(MyDataContract){…} } <service> <endpoint name=“MyService” address=“MyAddress” binding=“netTcpBinding” contract=“IMyInterface” /> Address + Binding + Contract = Endpoint Service Contract Definition Service Type [DataContract] public class MyDataContract { [DataMember] public string MyField; } Data Contract Definition
  • 27. References http://msdn2.microsoft.com/en-us/netframework/default.aspx http://www. gotdotnet .com/ Email: [email_address] Blog: Downloads @ blog