Presentation is loading. Please wait.

Presentation is loading. Please wait.

[Title of the course] WCF

Similar presentations


Presentation on theme: "[Title of the course] WCF"— Presentation transcript:

1 [Title of the course] WCF
20-Apr-17 [Title of the course] WCF WCF Copyright © SUPINFO. All rights reserved Copyright © NameOfTheOrganization. All rights reserved.

2 Course Objectives After this course, you will be able to:
20-Apr-17 Services [Title of the course] Course Objectives After this course, you will be able to: Understand how do Services work. Presentation, protocol and format. Create and consume a Service in .NET. Creating, deploying and consuming them. Optimize Services. By using cache, sessions… Copyright © NameOfTheOrganization. All rights reserved.

3 Course Topics This course is divided into the following sections:
20-Apr-17 Services [Title of the course] Course Topics This course is divided into the following sections: Introduction. Protocol and formats used in Services. Services in .NET. Creating, deploying and consuming Services in .NET. Optimizing Services. By using cache, sessions… Copyright © NameOfTheOrganization. All rights reserved.

4 [Title of the course] Introduction, protocol and format of services…
20-Apr-17 [Title of the course] Services Service Basics Introduction, protocol and format of services… Copyright © NameOfTheOrganization. All rights reserved.

5 Section Topics We are going to walk through the following chapters:
20-Apr-17 Service Basics [Title of the course] Section Topics We are going to walk through the following chapters: Introduction to Services SOAP Protocol WSDL Format UDDI Directory Copyright © NameOfTheOrganization. All rights reserved.

6 Introduction to Services
20-Apr-17 Service Basics [Title of the course] Introduction to Services A Service is a group of protocols and computer standards, used for exchanging data between applications. — Wikipedia, Copyright © NameOfTheOrganization. All rights reserved.

7 Introduction to Services
20-Apr-17 Service Basics [Title of the course] Introduction to Services SOA : Services Oriented Architecture OOP complement Used in processing and communicating with Services. Objectives Productive Reactive Capable of managing responsibility On peut citer la SNCF, qui a mis en place une architecture de type SOA pour son système de réservation (recherche d'horaire, demande de tarif, réservation...) qui prend en charge à la fois les terminaux des guichets des agences et gares, et les sollicitations de son site web de commande en ligne Les architectures SOA reposent principalement sur l’utilisation d’interface d’invocation (SOAP) et de vocabulaire de description de données (WSDL et XML) qui doivent être communs à l’ensemble des agents (fournisseurs de services et utilisateurs de services). la notion de SOA (pour architecture orientée services) définie un modèle d'interaction applicative mettant en oeuvre des connexions en couplage lâche entre divers composants logiciels (ou agents). Ici, on entend par "service" une action exécutée par un composant "fournisseur" à l'attention d'un composant "consommateur", basé éventuellement sur un autre système. Copyright © NameOfTheOrganization. All rights reserved.

8 Introduction to Services
20-Apr-17 Service Basics [Title of the course] Introduction to Services SOA : Services Oriented Architecture Based on 4 principals: The borders are explicit. The services are independent of one another. Contracts are shared, but not objects. Semantics are dictated by rules. Les frontières d’un service sont explicites : Le client et le développeur sont conscients que l’appel aux méthodes distantes se fait à travers des messages et passent par le réseau. Cela permet par exemple d’utiliser d’autres méthodes que la classique demande/réponse synchrone qui est utilisée pour simuler l’appel à une méthode locale. Les services sont indépendants : Un service est autonome, et donc ce sont les clients qui doivent s’adapter lors de l’évolution d’un service à une nouvelle version. L’avantage est qu’ainsi l’interaction entre plusieurs services se fait naturellement et les services s’adaptent entre eux aux nouvelles contraintes. Il est donc important pour le service de gérer les erreurs, surtout pour les clients qui ne seraient pas à jour. L’utilisation d’un service est décrite à l’aide d’un contrat : Le contrat est un représenté par un fichier XML. Il contient entre autres la structure des informations contenues dans les messages entrant et sortant. Ce contrat peut contenir de commentaires. Le contrat est souvent utilisé pour définir la construction des classes du client. La sémantique est dictée par des règles : La sémantique, le format des messages et la stratégie d’accès au service peuvent être spécifiés (si nécessaire) dans le contrat par des règles. Ainsi, un service peut définir qu’il n’accepte que les messages entrants encryptés d’une certaine façon, ou encore qu’il n’est accessible que dans une tranche horaire définie, etc. La définition de cette sémantique peut être consommée par un framework, pour que l’encryptage des données se fasse automatiquement sans intervention du développeur du client, par exemple. Copyright © NameOfTheOrganization. All rights reserved.

9 Introduction to Services
20-Apr-17 Service Basics [Title of the course] Introduction to Services A service and clients communicates by messages. A client sends a request, the server sends back a response. Copyright © NameOfTheOrganization. All rights reserved.

10 Introduction to Services
20-Apr-17 Service Basics [Title of the course] Introduction to Services Advantages and disadvantages of Services Advantages: Interoperability Simplified access Accessible data exchange format Centralized arrangement Disadvantages: Poor performance Ever-changing standards Avantages : Interopérabilité : Un service web développé en .Net pourra être consommé en Perl, en Java, en PHP… Accès simplifié : L’utilisation d’HTTP comme protocole d’accès aux services web évite les problèmes liés à l’utilisation de firewalls Format d’échange accessible : Les échanges entre le client et le service web est au format texte, ce qui facilite la compréhension et l’exploitation Mise à disposition centralisée : Services permettent de mettre à disposition à un seul endroit un composant utilisé en interne ou de le fournir à des prestataires ou des clients Inconvénients : Services ne sont pas performants : L’utilisation de format texte, des standards du web et la compatibilité entre plate formes sont à ce prix Une technologie en perpétuelle évolution : Les normes et les fonctionnalités ne cessent d’évoluer Copyright © NameOfTheOrganization. All rights reserved.

11 20-Apr-17 Service Basics [Title of the course] SOAP Protocol Allows the transmission of structured and formatted data in messages between 2 distant objects. Standard defined by W3C Based on XML Current version: 1.2 Il permet la transmission de messages entre objets distants, ce qui veut dire qu'il autorise un objet à invoquer des méthodes d'objets physiquement situés sur une autre machine. Le transfert se fait le plus souvent à l'aide du protocole HTTP, mais peut également se faire par un autre protocole, comme SMTP. Copyright © NameOfTheOrganization. All rights reserved.

12 SOAP Protocol Composition of a message Envelope:
20-Apr-17 Service Basics [Title of the course] SOAP Protocol Composition of a message Envelope: is the root element of SOAP message. contains no or several attributes. contains Header (optional) Body (mandatory) Copyright © NameOfTheOrganization. All rights reserved.

13 SOAP Protocol Composition of a message Service Basics Header :
20-Apr-17 Service Basics [Title of the course] SOAP Protocol Composition of a message Header : Optional Used for adding complementary information to the message Contains arguments: actor, mustUnderstand… Body : Contains data of the message Corresponds to the XML Schemas specified in the service contract. Copyright © NameOfTheOrganization. All rights reserved.

14 SOAP Protocol Example of a SOAP message Service Basics
20-Apr-17 Service Basics [Title of the course] SOAP Protocol Example of a SOAP message <soap:Envelope xmlns:" <soap:Header> </soap:Header> <soap:Body> </soap:Body> </soap:Envelope> Copyright © NameOfTheOrganization. All rights reserved.

15 20-Apr-17 Service Basics [Title of the course] WSDL Format WSDL defines, in an abstract and independent way, a group of operations and messages which can be transmitted to and from a given Service. — JDNet Developers, Copyright © NameOfTheOrganization. All rights reserved.

16 WSDL Format Service Description Language
20-Apr-17 Service Basics [Title of the course] WSDL Format Service Description Language Description language of Services in XML format Used to draft a Service: describing functionalities “how” “where” Current version: 2.0 Copyright © NameOfTheOrganization. All rights reserved.

17 WSDL Format Services Basics Le format wsdl sert a décrire un Service :
20-Apr-17 Services Basics [Title of the course] WSDL Format Le format wsdl sert a décrire un Service : Comment on communique avec ? Ou il se trouve ? Quelles opérations on peut faire avec ? Avec quelles données ? Copyright © NameOfTheOrganization. All rights reserved.

18 WSDL Format WSDL skeleton Service Basics <definition>
20-Apr-17 Service Basics [Title of the course] WSDL Format WSDL skeleton <definition> <type /> <message> <operation> <message /> </operation> <portType> <operation/> </portType> <binding> </binding> <service> <port> <binding/> </port> </service> </definition> Copyright © NameOfTheOrganization. All rights reserved.

19 UDDI Directory What is it?
20-Apr-17 Service Basics [Title of the course] UDDI Directory What is it? Universal Description, Discovery and Integration It is a directory of Services. which is a Service itself. It contains information on service providers (contracts, activities…) description on services (as part of the WSDL contract) Une fois qu'un Services est développé, il faut publier sa description et faire un lien vers elle dans un catalogue UDDI (Universal Description, Discovery and Integration), de sorte que les utilisateurs potentiels puissent le trouver. Quand un utilisateurs souhaite utiliser le service, il fait une demande de son fichier WSDL afin de connaître son emplacement, les appels de fonctions et comment y accéder. A partir de cela, il peut composer, par exemple, une requête SOAP (Simple Object Access Protocol) vers l'ordinateur du service. Tout ce parcours peut évidemment être automatisé à l'aide d'outils reconnaissant WSDL, et permet ainsi d'intégrer de nouveaux services pratiquement sans devoir entrer de nouveau code. Copyright © NameOfTheOrganization. All rights reserved.

20 UDDI Directory How does it work? Service Basics
20-Apr-17 Service Basics [Title of the course] UDDI Directory How does it work? 1. I am looking for a Service… 2. Tell you how to connect to it. 3. What is the format for messages? 5. I send my SOAP requests. 4. Here is my WSDL contract. 6. Result for the SOAP request. Copyright © NameOfTheOrganization. All rights reserved.

21 Do you have any questions?
20-Apr-17 Service Basics [Title of the course] Stop-and-Think Do you have any questions? Copyright © NameOfTheOrganization. All rights reserved.

22 Services in .NET Creating, deploying and consuming Services in .NET.
20-Apr-17 [Title of the course] Services Services in .NET Creating, deploying and consuming Services in .NET. Copyright © NameOfTheOrganization. All rights reserved.

23 In .NET you can use: WCF WCF RIA Services WCF Data Services
Course 6461A Introduction Module 1: Getting Started with Windows Communication Foundation In .NET you can use: WCF WCF RIA Services WCF Data Services Expliquer la dif entre les trois. Parler que Data Service se met derrière une DAL directement (pas même architecture). Parler que RIA peut être vu comme un complément plutôt qu’un concurrent. WCF reste le plus utilisé et celui qui nous donne la possibilité de tout faire 23

24 WCF and SOA WCF supports SOA:
Course 6461A Introduction Module 1: Getting Started with Windows Communication Foundation WCF and SOA WCF supports SOA: Most developers do not have to learn WSDL Lots of functionality is handled by the runtime Tools to enable easy creation and consumption of services However: Just because you have exposed an interface over a Web service protocol stack does not mean that you have created part of an SOA WCF plays the role of distribution mechanism, while SOA comes in at a higher level 24

25 Preview Section plan: Service-Oriented Development with WCF
Course 6461A WCF Basics Module 1: Getting Started with Windows Communication Foundation Preview Section plan: Service-Oriented Development with WCF Sending a WCF Message The ABC of Endpoints Structure of a Service A Unified Programming Model Communicating with Non-WCF Services 25

26 Module 1: Getting Started with Windows Communication Foundation
Course 6461A WCF Basics Module 1: Getting Started with Windows Communication Foundation A Unified Programming Model Many confusing and complicated options Remoting COM DCOM COM+ MSMQ WSE ASMX A unified development model Windows Communication Foundation

27 Service-Oriented Development with WCF
Course 6461A WCF Basics Module 1: Getting Started with Windows Communication Foundation Service-Oriented Development with WCF Create a service: Over a network protocol Use a service: Contact the service to access one part of that functionality Clients and services communicate by passing messages Not limited to one particular set of protocols Aimed at clients and services that do not share the same address space Service-oriented architecture is a bigger concept related to the style of the application and granularity of the services 27

28 A B C The ABC of endpoints Address WCF Basics
Course 6461A WCF Basics Module 1: Getting Started with Windows Communication Foundation The ABC of endpoints Where to find the service Example: Address A Service How to communicate with the service Example: BasicHttpBinding Binding B What the service can do for you Example: [OperationContract] int Add(int num1, int num2); Contract C 28

29 Module 1: Getting Started with Windows Communication Foundation
Course 6461A WCF Basics Module 1: Getting Started with Windows Communication Foundation Sending a WCF message WCF dispatcher Client Proxy Service Endpoints Binding Channel Channel Encoding Message Encoding Transport channel Transport channel

30 Module 1: Getting Started with Windows Communication Foundation
Course 6461A WCF Basics Module 1: Getting Started with Windows Communication Foundation Structure of a service .NET Classes and Interface Service Service Host Service Contracts for Domain Functionality or Metadata Exchange

31 Do you have any questions ?
20-Apr-17 WCF Basics [Title of the course] Stop-and-think Do you have any questions ? Copyright © NameOfTheOrganization. All rights reserved.

32 Defining a service contract
20-Apr-17 [Title of the course] Windows Communication Foundation Defining a service contract Using a Language-Level Interface as a Service Contract Copyright © NameOfTheOrganization. All rights reserved.

33 Module 1: Getting Started with Windows Communication Foundation
Course 6461A Defining a service contract Module 1: Getting Started with Windows Communication Foundation Preview Section plan: Example of a Simple Contract The ServiceContract Attribute The OperationContract Attribute Data and Messages Defining a data contract

34 Module 1: Getting Started with Windows Communication Foundation
Course 6461A Defining a service contract Module 1: Getting Started with Windows Communication Foundation Example of a Simple Contract using System; using System.ServiceModel; namespace ServiceContracts { [ServiceContract(Namespace=" ] public interface IService [OperationContract] HelloMessage GetHelloMessage(string name); } Principal namespace for WCF Attributes control exposure of types and methods

35 Module 1: Getting Started with Windows Communication Foundation
Course 6461A Defining a service contract Module 1: Getting Started with Windows Communication Foundation The ServiceContract attribute The ServiceContract attribute: Can be used on interfaces or classes Is identified by tools and environments that understand WCF Service contracts: Support services Are analogous to interfaces on a polymorphic object – caller may not know or care about other contracts Are only visible to clients if exported on an endpoint Contains one or more operations

36 Module 1: Getting Started with Windows Communication Foundation
Course 6461A Defining a service contract Module 1: Getting Started with Windows Communication Foundation The ServiceContract attribute Namespace serves to disambiguate types and operations in service metadata Defaults to Not to be confused with language-level namespace

37 Module 1: Getting Started with Windows Communication Foundation
Course 6461A Defining a service contract Module 1: Getting Started with Windows Communication Foundation The OperationContract Attribute The OperationContract Attribute: Attribute can be used on methods but not other class elements, such as properties or indexers Identified by tools and environments that understand WCF Methods are only visible in service contract if marked with OperationContract

38 Module 1: Getting Started with Windows Communication Foundation
Course 6461A Defining a service contract Module 1: Getting Started with Windows Communication Foundation Data and messages Parameters and return values must be marshaled between client and server CLR types are mapped to XML Infoset by serialization WCF enables you to define custom serialization Serialized data is packed into the message Contents and structure of message must be understood by client or service at the other end Data and message contracts provide control over these areas

39 Module 1: Getting Started with Windows Communication Foundation
Course 6461A Defining a service contract Module 1: Getting Started with Windows Communication Foundation Defining a data contract using System; using System.Runtime.Serialization; namespace DataContracts { [DataContract] public class HelloMessage private string _content; [DataMember] public string Content get { return _content; } set { this._content = value;} }

40 Module 1: Getting Started with Windows Communication Foundation
Course 6461A Defining a service contract Module 1: Getting Started with Windows Communication Foundation Implementing a service contract Define a class implementing the service contract using System; using ServiceContracts; using DataContracts; namespace ServiceImplementation { public class HelloService : IService public HelloMessage GetMessage(string name) // Write implementation code here }

41 Do you have any questions ?
20-Apr-17 Defining a service contract [Title of the course] Stop-and-think Do you have any questions ? Copyright © NameOfTheOrganization. All rights reserved.

42 Service contracts and implementation
20-Apr-17 Defining a service contract [Title of the course] Demonstration Service contracts and implementation Copyright © NameOfTheOrganization. All rights reserved.

43 Hosting and Consuming a WCF Service
20-Apr-17 [Title of the course] Windows Communication Foundation Hosting and Consuming a WCF Service Copyright © NameOfTheOrganization. All rights reserved.

44 Preview Separation of Concerns in a WCF Service
Course 6461A Hosting and Consuming a WCF Service Module 2: Configuring and Hosting WCF Services Preview Separation of Concerns in a WCF Service Life Cycle of a Self-Hosted WCF Service Consuming a WCF Service Configuring a WCF Service Host and a client Generating artifacts from service metadata

45 Separation of Concerns in a WCF Service
Course 6461A Hosting and Consuming a WCF Service Module 2: Configuring and Hosting WCF Services Separation of Concerns in a WCF Service WCF solution WCF Service Library Contract Implementation WCF Service Host Configuration Host code

46 Life Cycle of a Self-Hosted WCF Service
20-Apr-17 Hosting and Consuming a WCF Service [Title of the course] Life Cycle of a Self-Hosted WCF Service Using the namespace System.ServiceModel Instantiate a Service Host object System.ServiceModel.ServiceHost Add a service endpoint with : Contract Binding Address Open the ServiceHost to start listening 1 2 3 Copyright © NameOfTheOrganization. All rights reserved.

47 Life Cycle of a Self-Hosted WCF Service
20-Apr-17 Hosting and Consuming a WCF Service [Title of the course] Life Cycle of a Self-Hosted WCF Service Prevent the ServiceHost from closing (i.e Console.ReadLine() Close and dispose of the ServiceHost object 4 5 ServiceHost Service type Address Copyright © NameOfTheOrganization. All rights reserved.

48 20-Apr-17 Hosting and Consuming a WCF Service [Title of the course] Calling a WCF Service To call a WCF service, the client needs the following: A channel over which to pass messages Transport channel at the bottom The makeup of the channel derives from the binding A client-side representation of the contract Referencing the service contracts assembly Generating artifacts from metadata A way of creating WCF messages to pass across the channel and a way of retrieving message contents An address for the WCF service Copyright © NameOfTheOrganization. All rights reserved.

49 Module 1: Getting Started with Windows Communication Foundation
Course 6461A Hosting and Consuming a WCF Service Module 1: Getting Started with Windows Communication Foundation Contracts, metadata and artifacts Running Service Implements Service Assembly Service Class Service Metadata Generate Generate Service Interface Generate Service Proxy ServiceModel Metadata Utility Tool (Svcutil.exe) generates metadata and artifacts Proxy Artifacts Implements

50 Consuming a service (1) Using the ChannelFactory class
20-Apr-17 Hosting and Consuming a WCF Service [Title of the course] Consuming a service (1) Using the ChannelFactory class Reference the Service Contracts assembly Instantiate a typed Channel Factory with the binding and the address of the service System.ServiceModel.ChannelFactory<T> T represents the type of the contract Call the CreateChannel() method to contact the service and create a proxy Start calling the methods… 1 2 3 4 Copyright © NameOfTheOrganization. All rights reserved.

51 « First WCF Demo » Demonstration Hosting and Consuming a WCF Service
20-Apr-17 Hosting and Consuming a WCF Service [Title of the course] Demonstration « First WCF Demo » Copyright © NameOfTheOrganization. All rights reserved.

52 File-based configuration
Course 6461A Hosting and Consuming a WCF Service Module 2: Configuring and Hosting WCF Services File-based configuration File-based configuration You can use app.config, web.config, and machine.config files You can change the WCF configuration without recompiling the assembly Programmatic configuration Provides greater control of your WCF configuration Takes precedence over file-based configuration

53 Identifying WCF Entries in Configuration Files
Course 6461A Hosting and Consuming a WCF Service Module 2: Configuring and Hosting WCF Services Identifying WCF Entries in Configuration Files Host configuration file <system.serviceModel> <services> <service name=”ServiceImplementation.HelloService"> <endpoint address=" binding="basicHttpBinding" contract="ServiceContract.IService"/> </service> </services> </system.serviceModel> Client configuration file <system.serviceModel> <client> <endpoint name="tcpEndpoint" address=" binding="basicHttpBinding" contract="ServiceContract.IService"/> </client> </system.serviceModel>

54 « Configuration » Demonstration Hosting and Consuming a WCF Service
20-Apr-17 Hosting and Consuming a WCF Service [Title of the course] Demonstration « Configuration » Copyright © NameOfTheOrganization. All rights reserved.

55 Obtaining Service Information
Course 6461A Hosting and Consuming a WCF Service Module 2: Configuring and Hosting WCF Services Obtaining Service Information Obtain information from service metadata and generate artifacts WCF Service WCF types MEX endpoint Artifacts Obtain information and artifacts manually from service provider

56 20-Apr-17 Hosting and Consuming a WCF Service [Title of the course] Consuming a service (2) Using generated artifacts – Mex (Metadata Exchange) Add a reference to the service (“Add Service Reference”) The tool Svcutil.exe generates code from the metadata of the service: Proxy classes and interface Instantiate a proxy service class object Start calling the methods… 1 2 3 Copyright © NameOfTheOrganization. All rights reserved.

57 « Mex » Demonstration Hosting and Consuming a WCF Service 20-Apr-17
[Title of the course] Demonstration « Mex » Copyright © NameOfTheOrganization. All rights reserved.

58 Solutions to host a WCF Service
20-Apr-17 [Title of the course] Windows Communication Foundation Solutions to host a WCF Service Copyright © NameOfTheOrganization. All rights reserved.

59 Preview Hosting a service in a self-managed Application
Course 6461A Solutions to host a WCF Service Module 2: Configuring and Hosting WCF Services Preview Hosting a service in a self-managed Application Hosting a service in a Windows Service Hosting a service in IIS Hosting a service in WAS

60 Hosting a service Host environment Solutions to host a WCF Service
20-Apr-17 Solutions to host a WCF Service [Title of the course] Hosting a service Host environment Typical functionality: Reads and understands WCF configuration settings Creates endpoints and listens for requests from remote clients Routes requests to an appropriate service instance Creates and destroys service instances Additional functionality: Isolate different service instances from each other Serialize and re-activate unused service instances Manage pre-created pools of service instances Copyright © NameOfTheOrganization. All rights reserved.

61 Service Hosting Options
20-Apr-17 Solutions to host a WCF Service [Title of the course] Service Hosting Options Self-hosted managed application IIS WAS IIS and WAS offer the following improved hosting features: Message-based activation Process recycling Idle shutdown Process health monitoring Copyright © NameOfTheOrganization. All rights reserved.

62 Hosting a WCF Service in a Self-Hosted Managed Application
Course 6461A Solutions to host a WCF Service Module 2: Configuring and Hosting WCF Services Hosting a WCF Service in a Self-Hosted Managed Application Windows Forms application Windows service Windows Console application WPF application

63 Implementing a Self-Hosted Service
20-Apr-17 Solutions to host a WCF Service [Title of the course] Implementing a Self-Hosted Service Manually activated by starting process Need to write your own hosting code WCF configuration in the app.config file Expose your WCF service over any protocol Self-hosted service application Service host code WCF configuration Copyright © NameOfTheOrganization. All rights reserved.

64 Hosting in a Windows Service
20-Apr-17 Solutions to host a WCF Service [Title of the course] Hosting in a Windows Service Easily auto-started on startup Manage process life cycle in the management console snap-in Subclass ServiceBase and override OnStart and OnStop protected override void OnStart(string[] args) { //Instantiate the ServiceHost... } protected override void OnStop() // Close the ServiceHost... Copyright © NameOfTheOrganization. All rights reserved.

65 « Windows Service Deployment »
20-Apr-17 Solutions to host a WCF Service [Title of the course] Demonstration « Windows Service Deployment » Copyright © NameOfTheOrganization. All rights reserved.

66 Implementing an IIS-Hosted Service
20-Apr-17 Solutions to host a WCF Service [Title of the course] Implementing an IIS-Hosted Service Instances activated when messages arrive No hosting code required from service developer WCF configuration in web.config file Limited to HTTP protocol Need service file (.svc) containing ServiceHost directive to link IIS to service class Service="ServiceImplementation.HelloService"%> In its simplest form, you can store the service classes in the App_Code sub directory Copyright © NameOfTheOrganization. All rights reserved.

67 « IIS Deployment » Demonstration Solutions to host a WCF Service
20-Apr-17 Solutions to host a WCF Service [Title of the course] Demonstration « IIS Deployment » Copyright © NameOfTheOrganization. All rights reserved.

68 Implementing a WAS-Hosted Service
20-Apr-17 Solutions to host a WCF Service [Title of the course] Implementing a WAS-Hosted Service No hosting code required from service developer WCF configuration in web.config file Not limited to the HTTP protocol Need service file (.svc) containing ServiceHost directive to link IIS to service class Service="ServiceImplementation.HelloService"%> Copyright © NameOfTheOrganization. All rights reserved.

69 20-Apr-17 Solutions to host a WCF Service [Title of the course] Configuring WAS Enable “WCF Non-Http Activation Components” Windows components Bind desired Web site (usually default) to a non-HTTP port to support non-HTTP-based activation appcmd set site "Default Web Site"-+bindings.[protocol='net.tcp',bindingInformation='9000:*'] appcmd set app "Default Web Site/BankService“ /enabledProtocols:http,net.tcp,net.pipe Copyright © NameOfTheOrganization. All rights reserved.

70 Preparing Services for Deployment
Course 6461A Solutions to host a WCF Service Module 2: Configuring and Hosting WCF Services Preparing Services for Deployment Ultimately the service must leave the development environment Deployment mechanism and process depends on type of service host

71 Deploying IIS-Hosted Services
Course 6461A Solutions to host a WCF Service Module 2: Configuring and Hosting WCF Services Deploying IIS-Hosted Services Compile code Install correct runtime Check endpoint addresses Disable debugging

72 + Deploying WAS-Hosted Services Solutions to host a WCF Service
Course 6461A Solutions to host a WCF Service Module 2: Configuring and Hosting WCF Services Deploying WAS-Hosted Services Install correct runtime + Perform WAS setup: Install components Configure non-HTTP activation Check endpoint addresses Disable debugging Compile code

73 Deploying Self-Hosted Services
Course 6461A Solutions to host a WCF Service Module 2: Configuring and Hosting WCF Services Deploying Self-Hosted Services Create a Windows Installer (MSI) for the classes Register your Windows Service at installation time by using ServiceProcessInstaller and ServiceInstaller [RunInstaller(true)] public class ProjectInstaller : Installer { private ServiceProcessInstaller process; private ServiceInstaller service; public ProjectInstaller() process = new ServiceProcessInstaller(); process.Account = ServiceAccount.LocalSystem; service = new ServiceInstaller(); service.ServiceName =  "HelloService"; Installers.Add(process); Installers.Add(service); }

74 Do you have any questions?
20-Apr-17 Services [Title of the course] Stop-and-Think Do you have any questions? Copyright © NameOfTheOrganization. All rights reserved.

75 For more… If you want to go into the topic more deeply,
20-Apr-17 Services [Title of the course] For more… If you want to go into the topic more deeply, Books Courses ASP.NET 2.0 Basics Security and Customization of Web Applications Websites Copyright © NameOfTheOrganization. All rights reserved.

76 You have successfully completed
20-Apr-17 [Title of the course] Congratulations You have successfully completed Module 4 Services Copyright © NameOfTheOrganization. All rights reserved. 76

77 End Adopt Services for your distributed applications!
20-Apr-17 Services [Title of the course] End Adopt Services for your distributed applications! You have finished the modules ASP.NET 2.0 and Services! Copyright © NameOfTheOrganization. All rights reserved.


Download ppt "[Title of the course] WCF"

Similar presentations


Ads by Google