Dot Net Training Wcf Dot Net35


Published on

Published in: Business, Technology
1 Comment
1 Like
  • IT Pathshala, Noida-Sector-63, offers Guaranteed JOB with .NET Training Programs.


    CALL US - +91-9871350999 or +91-8800394970

    Technology Centre Address: H-110, Sector-63, Noida (UP)

    Program Takeaways:

    - GUARANTEED JOB in your technology domain
    - Live Major Project development
    - Experience Letter on Training Completion
    - Certification on Training Completion
    - Project Source Code available in CD

    Program Highlights:

    - 100% Guaranteed Job – Don’t pay us if you don’t get a JOB!
    - Industry Ready Courses
    - LIVE International Project Experience
    - Exposure to corporate culture at our IT services facility
    - Networking & Interaction with Industry Experts
    - Training Provided by a reputed IT Company
    - Live Project Source Code made available in CD
    - Technology certification and experience letter at program completion
    - Online Study Content

    CALL US - +91-9871350999 or +91-8800394970

    Our website:
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Dot Net Training Wcf Dot Net35

  1. 1. Microsoft .Net Framework 3.x The Windows Communication Foundation
  2. 2. Agenda <ul><li>.Net 3.x </li></ul><ul><li>The WCF- Developers perspective </li></ul><ul><li>The WCF Architecture </li></ul><ul><li>ABC … </li></ul><ul><li>Fault Tolerance </li></ul><ul><li>Demos / Hands on </li></ul><ul><li>Questions and Answers </li></ul>
  3. 3. <ul><li>.Net 3.0: </li></ul><ul><ul><li>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. </li></ul></ul><ul><ul><li>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. </li></ul></ul>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. 4. What's new in .Net 3.0 – A developer perspective <ul><li>Programming model for Windows </li></ul><ul><li>.NET Framework 3.0 consists of these basic components: </li></ul><ul><ul><li>.NET Framework 2.0 </li></ul></ul><ul><ul><li>Microsoft® Windows® Presentation Foundation (formerly Avalon) </li></ul></ul><ul><ul><li>Microsoft® Windows® Communication Foundation (formerly Indigo) </li></ul></ul><ul><ul><li>Microsoft® Windows® Workflow Foundation </li></ul></ul><ul><ul><li>Windows CardSpace® (formerly code named &quot;Infocard&quot;) </li></ul></ul>
  5. 5. Windows Communication Foundation <ul><li>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 </li></ul><ul><li>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. </li></ul><ul><li>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 </li></ul>
  6. 6. WCF in a Nutshell <ul><li>Three main design goals of WCF are: </li></ul><ul><li>Unification of existing technologies </li></ul><ul><li>Interoperability across platforms </li></ul><ul><li>Service-oriented development </li></ul><ul><li>WCF offers immensely valuable support for reliability, transactions, concurrency management, security, and instance activation </li></ul><ul><li>WCF comes with a unified programming model providing: </li></ul><ul><li>A single API for building connected systems </li></ul><ul><li>Built-in support for a broad set of web service protocols </li></ul><ul><li>Implicit use of service-oriented development principles </li></ul><ul><li>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 </li></ul>
  7. 7. WCF in a Nutshell
  8. 8. WCF in a Nutshell <ul><li>The WCF stack maps almost on a one-to-one basis to all the SOA principles </li></ul>
  9. 9. WCF Communication <ul><li>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. </li></ul><ul><li>Same-machine communication Cross-machine communication </li></ul>
  10. 10. The WCF architecture
  11. 11. WCF
  12. 12. WCF – Contracts <ul><li>Contracts and Descriptions </li></ul><ul><li>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. </li></ul><ul><li>Service Contracts - Describes the operations a service can perform. Maps CLR types to WSDL. </li></ul><ul><li>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. </li></ul><ul><li>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. </li></ul><ul><li>Fault contracts - Define which errors are raised by the service, and how the service handles and propagates errors to its clients. </li></ul>
  13. 13. WCF <ul><li>Service Runtime </li></ul><ul><li>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. </li></ul><ul><li>Throttling controls how many messages are processed, which can be varied if the demand for the service grows to a preset limit. </li></ul><ul><li>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. </li></ul><ul><li>Metadata behavior governs how and whether metadata is made available to the outside world. </li></ul><ul><li>Instance behavior specifies how many instances of the service can be run (for example, a singleton specifies only one instance to process all messages). </li></ul><ul><li>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. </li></ul><ul><li>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. </li></ul>
  14. 14. The ABC of WCF
  15. 15. The ABC of WCF <ul><li>ABC means that writing (and configuring) a WCF service is always a three-step process </li></ul><ul><li>Define a contract and implement it on a service </li></ul><ul><li>Choose or define a service binding that selects a transport along with quality of service, security and other options </li></ul><ul><li>Deploy an endpoint for the contract by binding it (using the binding definition, hence the name) to a network address. </li></ul><ul><li>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. </li></ul><ul><li>&quot;A&quot; stands for Address—as expressed in the wsdl:service section and links wsdl:binding to a concrete service endpoint address. </li></ul><ul><li>&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. </li></ul><ul><li>&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. </li></ul>
  16. 16. WCF <ul><li>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: </li></ul><ul><li>Address: The endpoints specify a Address that defines where the endpoint is hosted. </li></ul><ul><li>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. </li></ul><ul><li>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. </li></ul>
  17. 17. WCF-Address <ul><li>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. </li></ul><ul><li>scheme://<machinename>[:port]/path1/path2 </li></ul><ul><li>WCF supports the following transport schemas: </li></ul><ul><li>HTTP </li></ul><ul><li>TCP </li></ul><ul><li>Peer network </li></ul><ul><li>IPC (Inter-Process Communication over named pipes) </li></ul><ul><li>MSMQ </li></ul><ul><li>http://localhost:8001 </li></ul><ul><li>http://localhost:8001/MyService </li></ul><ul><li>net.tcp://localhost:8002/MyService </li></ul><ul><li>net.pipe://localhost/MyPipe </li></ul><ul><li>net.msmq://localhost/private/MyService </li></ul><ul><li>net.msmq://localhost/MyService </li></ul>
  18. 18. WCF-Binding <ul><li>A binding provides a consistent, canned set of choices regarding the transport protocol, message encoding, communication pattern, reliability, security, transaction propagation, and interoperability. </li></ul><ul><li>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. </li></ul><ul><li>The binding controls the following: </li></ul><ul><li>·   The transport (HTTP, MSMQ, Named Pipes, TCP) </li></ul><ul><li>·   The channels (one-way, duplex, request-reply) </li></ul><ul><li>·   The encoding (XML, binary, MTOM…) </li></ul><ul><li>·   The supported WS-* protocols (WS-Security, WS-Federation, WS-Reliability, WS-Transactions) </li></ul>
  19. 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  
  20. 20. WCF-Choosing a Binding
  21. 21. WCF – Fault Tolerance <ul><li>In raw .NET programming, any unhandled exception immediately terminates the process it took place in. That is not the WCF behaviour, however. </li></ul><ul><li>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. </li></ul><ul><li>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. </li></ul><ul><li>T he service should throw an instance of the FaultException<T> class </li></ul><ul><li>[FaultContract(typeof(DivideByZeroException))] </li></ul><ul><li>double Divide(double number1,double number2); //More methods </li></ul>
  22. 22. WCF - Looking ahead <ul><li>SOAP and WS-* and the enterprise </li></ul><ul><li>Web (or REST), the enterprise, and the rest </li></ul>XML SOAP WS-* Web WCF in .NET Fx 3.0 WCF in .NET Fx 3.5 (Orcas) Rss & Atom
  23. 23. A Performance Comparison of WCF with Existing Distributed Communication Technologies <ul><li>ASP.NET Web Services (ASMX) : WCF is 25%—50% faster than ASP.NET Web Services </li></ul><ul><li>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 </li></ul><ul><li>.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. </li></ul><ul><li>.NET Remoting: approximately 25% faster than .NET Remoting </li></ul>
  24. 24. DEMO-WCF <ul><li>Hello world </li></ul><ul><li>Using svcutil </li></ul><ul><li>Logging and debugging </li></ul><ul><li>Multiple hosting environments </li></ul><ul><li>Using VS2005 to generate proxy </li></ul><ul><li>Fault Tolerance </li></ul><ul><li>Web WCF Service </li></ul><ul><li>Atom / RSS WCF Service </li></ul><ul><li>Hosting WF in Service </li></ul>
  25. 25. Q & A <ul><li>How are messages dispatched to an object? </li></ul><ul><li>How is the lifetime of that object controlled? </li></ul><ul><li>How does WCF work? </li></ul><ul><li>How do I extend WCF? </li></ul><ul><li>How do I control the threading model? </li></ul>
  26. 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. 27. References <ul><li> </li></ul><ul><li>http://www. gotdotnet .com/ </li></ul><ul><li>Email: [email_address] </li></ul><ul><li>Blog: </li></ul><ul><li>Downloads @ blog </li></ul>
  28. 28. Questions and Answers