1 / 22

Windows Communication Foundation

Windows Communication Foundation. Štěpán Bechynský Developer Evangelist Microsoft s.r.o. s tepan .bechynsky@microsoft.com. Distribuované aplikace nyní. Různé technologie WSE, Remoting, RMI, EJB, COM+, JMS, ... Navzájem nekompatibilní Vývoj je závislý na zvolené technologii

Télécharger la présentation

Windows Communication Foundation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Windows Communication Foundation Štěpán Bechynský Developer Evangelist Microsoft s.r.o. stepan.bechynsky@microsoft.com

  2. Distribuované aplikace nyní • Různé technologie • WSE, Remoting, RMI, EJB, COM+, JMS, ... • Navzájem nekompatibilní • Vývoj je závislý na zvolené technologii • Při změně technologie nutný velký zásah do aplikace

  3. Address Adresa, kde služba běží Binding Způsob komunikace služby Contract Poskytované rozhraní (metody, data) Nezávislé na AB WCF – základní koncepce

  4. C C C B B B A A A Address, Binding, Contract Klient Služba Zpráva Address Binding Contract (Kde) (Jak) (Co)

  5. Contract – typy • Service • Popisuje poskytované služby • Data • Popisuje strukturu poskytovaných dat • Message • Modifikuje strukturu SOAP zprávy

  6. Service Contract – typy • Request – Response • OneWay • Bez odpovědi • Duplex • Asynchronní metody • Nelze použít pro všechny typy Bindings • Fault • Chyba, kterou nelze ošetřit na serveru

  7. Service Contract – kód [ServiceContract] public interface ICalculator { [OperationContract] ComplexProblem SolveProblem (ComplexProblem p); }

  8. Data Contract – kód [DataContract] public class ComplexNumber { [DataMember] public double Real = 0.0D;[DataMember] public double Imaginary = 0.0D; public ComplexNumber(double r, double i) { this.Real = r; this.Imaginary = i; } }

  9. Message Contract – kód [MessageContract] public class ComplexProblem { [MessageHeader] public string operation; [MessageBody]public ComplexNumber n1; [MessageBody]public ComplexNumber n2; [MessageBody]public ComplexNumber solution; // Constructors… }

  10. Implementace služby

  11. Binding – přehled T = Transport Security | S = WS-Security Message Security

  12. Binding – konfigurace <?xml version="1.0" encoding="utf-8" ?> <configuration xmlns= "http://schemas.microsoft.com/.NetConfiguration/v2.0"> <system.serviceModel> <services> <service type="CalculatorService"> <endpoint address=“http://localhost/calculator" binding="basicHttpBinding" contractType="ICalculator" /> </service> </services> </system.serviceModel> </configuration>

  13. Hostování služeb • ServiceHost using(ServiceHost host = new ServiceHost( serviceType, baseAdresses)) { host.Open(); … host.Close(); } • IIS • Service.svc <%@ServiceHost Service="serviceType" %>

  14. Hostování služby ServiceHost

  15. Behaviors – chování služby • Vývojář • Concurrency • Instancing • Správce • Throttling • Metadata exposure

  16. Instancing • Per call • Pro každý požadavek nová instance • Singleton • Pro všechny požadavky jedna instance • Private Session • Co klient to jedna instance • Shared Session • Pro skupinu klientů jedna instance

  17. Throttling <service type="Calculator" behaviorConfiguration="CalculatorBehavior"> <!-- endpoint definitions /--> </service> <behaviors> <behavior configurationName="CalculatorBehavior"> <serviceThrottling maxConcurrentCalls="10" maxConnections="10" maxInstances="10" maxPendingOperations="10" /> </behavior> </behaviors>

  18. Behaviors Publikace metadat

  19. Vytvoření klienta • Proxy • Konfigurace • svcutil

  20. Klient

  21. Závěr Address Binding Contract

More Related