WCf foundation

  • Upload
    harish

  • View
    225

  • Download
    0

Embed Size (px)

Citation preview

  • 8/14/2019 WCf foundation

    1/36

  • 8/14/2019 WCf foundation

    2/36

    Agenda

    What Is the WindowsCommunication Foundation?

    How Does It Work? How Do I Use and Deploy It? Bindings Addresses Contracts How to host WCF services in ASP.NET How WCF works inside of ASP.NET

  • 8/14/2019 WCf foundation

    3/36

    WCF is

    Our next-generation platform for distributed systems

    A set of extensions to the Microsoft.NET Framework 2.0

    Build WCF services in Visual Studio 2005 using any .NET

    Language Intelligent code editing, IDE Extensions for WCF, debugging, re-

    factoring, code snippets, etc.

    Visual Basic .NET, Visual C#, etc.

    Runs on

    Microsoft Windows Vista Microsoft Windows XP

    Microsoft Windows Server 2003

  • 8/14/2019 WCf foundation

    4/36

    .NET at the core

    The Unified

    Framework ForRapidly Building

    Service-Oriented

    Applications

  • 8/14/2019 WCf foundation

    5/36

    Windows CommunicationFoundation

    Unifies todays distributed technologies Lets you develop/deploy/manage one

    model

    Visual Studio 2005 integration

    Broad support for Web services(WS-*) specifications

    Compatible with existing Microsoft-

    distributed application technologies

    Enables development ofloosely-coupled services

    Config-based communication

  • 8/14/2019 WCf foundation

    6/36

    Unified Programming

    Model

    InteropInteropwith otherwith otherplatformsplatforms

    ASMX

    Attribute-Attribute-

    BasedBasedProgrammingProgramming

    EnterpriseServices

    WS-*WS-*ProtocolProtocolSupportSupport

    WSE

    Message-Message-

    OrientedOrientedProgrammingProgramming

    System.Messaging

    ExtensibilityExtensibilityLocationLocation

    transparencytransparency

    .NETRemoting

  • 8/14/2019 WCf foundation

    7/36

    Agenda

    What Is the Windows CommunicationFoundation?

    How Does It Work? How Do I Use and Deploy It? Bindings Addresses Contracts How to host WCF services in ASP.NET How WCF works inside of ASP.NET

  • 8/14/2019 WCf foundation

    8/36

    How does it work?Endpoints

    ClientClient ServiceService

    MessageMessageEndpointEndpoint EndpointEndpoint

    EndpointEndpoint

  • 8/14/2019 WCf foundation

    9/36

    How does it work?Address, Binding, Contract

    ClientClient ServiceService

    MessageMessageAABBCC AA BB CC

    AA BB CC

    AddressAddress BindingBinding ContractContract

    (Where)(Where) (How)(How) (What)(What)

  • 8/14/2019 WCf foundation

    10/36

    How does it work?Behaviours and Metadata

    ClientClient ServiceService

    MessageMessageAABBCC AA BB CC

    AA BB CC

    MetadataMetadata

    BvBv BvBv

    BvBv BvBv

    ProxyProxy ServiceHost()ServiceHost()

  • 8/14/2019 WCf foundation

    11/36

    Agenda

    What Is the Windows CommunicationFoundation?

    How Does It Work? How Do I Use and Deploy It? Bindings Addresses Contracts How to host WCF services in ASP.NET How WCF works inside of ASP.NET

  • 8/14/2019 WCf foundation

    12/36

    How do I use it?

    ClientClient

    ServiceService

  • 8/14/2019 WCf foundation

    13/36

    How do I deploy it?

    For HTTP services on Windows XP SP2 & WS2K3 For any service on Windows Vista and Windows Server

    Longhorn

    Proven reliability, scalability, and security Requires a .svc file to identify the Service Type

    Web Host within IIS:

    Self-Host within any .NET process:

    Available for any service Console apps, windowed apps, .NET NT Services

  • 8/14/2019 WCf foundation

    14/36

  • 8/14/2019 WCf foundation

    15/36

    Agenda

    What Is the Windows CommunicationFoundation?

    How Does It Work? How Do I Use and Deploy It? Bindings Addresses Contracts How to host WCF services in ASP.NET How WCF works inside of ASP.NET

  • 8/14/2019 WCf foundation

    16/36

    All About BindingsYou can choose a pre-defined binding:

    NetPeerTcpBinding

    NetMSMQBinding

    NetNamePipesBinding

    NetTcpBinding

    WsHttpBinding

    BasicHttpBinding

    Binding

    .NET Peer Peer

    .NET.NET via MSMQ

    .NET.NET across processesSecure, reliable duplexed

    .NET.NET across processesSecure, reliable duplexed

    Basis for WS-* interopSupports WS-Security, WS-RM, WS-Tx

    Basic Profile 1.1 Interop and Intergration w/ASMX

    Purpose

  • 8/14/2019 WCf foundation

    17/36

    All About BindingsYou can customize a pre-defined binding:

  • 8/14/2019 WCf foundation

    18/36

    All About BindingsYou can define custom bindings:

  • 8/14/2019 WCf foundation

    19/36

    Agenda

    What Is the Windows CommunicationFoundation?

    How Does It Work? How Do I Use and Deploy It? Bindings Addresses Contracts How to host WCF services in ASP.NET How WCF works inside of ASP.NET

  • 8/14/2019 WCf foundation

    20/36

    All about AddressesAn endpoint address is relative to a base address:

    r a Web-Hosted service, the base address is that of its virtual director

  • 8/14/2019 WCf foundation

    21/36

    Agenda

    What Is the Windows CommunicationFoundation?

    How Does It Work? How Do I Use and Deploy It? Bindings Addresses Contracts How to host WCF services in ASP.NET How WCF works inside of ASP.NET

  • 8/14/2019 WCf foundation

    22/36

    All About Contracts

    Service Contract: Describes theoperations a service can perform. Maps

    CLR types to WSDL. Data Contract: Describes a data

    structure. Maps CLR types to XSD.

    Message Contract: Defines thestructure of the message on the wire.Maps CLR types to SOAP messages.

  • 8/14/2019 WCf foundation

    23/36

    Agenda

    What Is the Windows CommunicationFoundation?

    How Does It Work? How Do I Use and Deploy It? Bindings Addresses

    Contracts How to host WCF services in ASP.NET How WCF works inside of ASP.NET

  • 8/14/2019 WCf foundation

    24/36

    Hosting Services inASP.NET

    Write your service as usual: [ServiceContract]

    [OperationContract] etc.

    ServiceHosts are represented as .svc files:

    Service attribute is a CLR type name

    Matches from web.config

  • 8/14/2019 WCf foundation

    25/36

    Where can I put myservice code?

    Anywhere you can put code in ASP.NET: Inline in the .svc file

    In a .cs/.vb in App_Code In a class library (.dll) located in \bin

    WCF plays nicely with ASP.NETs dynamic

    compilation system

  • 8/14/2019 WCf foundation

    26/36

    Which project type shouldI use?

    Services can be built in any project type Web projects

    Class Libraries

    Class libraries have benefits Decouples implementation from hosting environment

    Can test services in other hosts (e.g. console apps)during development

    However, WCF doesnt care which project typeyou useuse what makes sense for you

  • 8/14/2019 WCf foundation

    27/36

  • 8/14/2019 WCf foundation

    28/36

    Agenda

    What Is the Windows CommunicationFoundation?

    How Does It Work? How Do I Use and Deploy It? Bindings Addresses Contracts How to host WCF services in ASP.NET How WCF works inside of ASP.NET

  • 8/14/2019 WCf foundation

    29/36

    IIS Worker Process

    (w3wp.exe)

  • 8/14/2019 WCf foundation

    30/36

    w3wp.exe

    ASP.NET

  • 8/14/2019 WCf foundation

    31/36

    w3wp.exe

    ASP.NET Managed Hosting Layer

    (System.Web.Hosting, System.Web.Compilation)

    ASP.NETPage Framework, UI, Controls,HTTP Runtime(System.Web, System.Web.UI)

  • 8/14/2019 WCf foundation

    32/36

    w3wp.exe

    ASP.NET Managed Hosting Layer

    (System.Web.Hosting, System.Web.Compilation)

    ASP.NETPage Framework, UI,Controls,HTTP Runtime(System.Web,

    System.Web.UI)

    WCF Service Model(System.ServiceModel)Can share state

  • 8/14/2019 WCf foundation

    33/36

    WCF and the HTTP Pipeline

    IISIIS

    ASP

    .NET

    ASP

    .NET

    HTTPRequest

    HTTPRequest

    Service ImplementationService Implementation

    Process HostProcess Host

    WCF HttpModule(grabs *.svc)

    WCF HttpModule(grabs *.svc)

    WCF

    WCF

    HTTP TransportHTTP Transport

    Protocol ChannelsProtocol Channels

    DispatcherDispatcher

    HTTPResponse

    HTTPResponse

    Other HttpModuleOther HttpModuleOther HttpModuleOther HttpModule

    Other HttpModuleOther HttpModule

  • 8/14/2019 WCf foundation

    34/36

    Why the split?

    Two technologies, different priorities

    WCF: consistency across transports and

    hosting environments ASP.NET: optimize for HTTP applications

    hosted in IIS

    Becomes very important on IIS7/WAS WAS == Windows Process Activation Service

  • 8/14/2019 WCf foundation

    35/36

    Implications

    ASP.NET platform features stillwork for ASP.NET Forms auth Session state File/URL authorization

    They just dont apply to WCF bydefault

  • 8/14/2019 WCf foundation

    36/36

    Summary

    What Is the Windows CommunicationFoundation?

    How Does It Work? How Do I Use and Deploy It? Bindings Addresses Contracts How to host WCF services in ASP.NET How WCF works inside of ASP.NET