Wcf Quickstart
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

Wcf Quickstart

  • 3,951 views
Uploaded on

WCF Quickstart presentation from St Louis Day of .NET 2009

WCF Quickstart presentation from St Louis Day of .NET 2009

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
3,951
On Slideshare
3,934
From Embeds
17
Number of Embeds
2

Actions

Shares
Downloads
306
Comments
0
Likes
4

Embeds 17

http://www.slideshare.net 16
http://www.linkedin.com 1

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. WCF Quick Start with Chris Deweese
  • 2. .NET Architect
    Specialties: SOA, Xml, Distributed Messaging
    Primarily work on System Integration & Information Sharing projects
    2009 Microsoft MVP, Solutions Architect
    Twitter @cdeweese – use #stldodn for conference
    http://christopherDeweese.com/
    Avid Xbox player (when kids are sleeping)
    About Chris Deweese
  • 3. Agenda
    Why & What of WCF
    Building a service
    Lessons Learned
  • 4. Why Services?
    Encapsulation of business capabilities.
    “Unit of work exposed to the world” – Juval Lowy
    Support multiple front-ends with one service
    Exposes data model using contracts (Schema, WSDL)
    Improves interoperability and automation
  • 5. What is WCF?
    Framework for building service-oriented applications
    Separates the logic of services from the channels they communicate on
    Messages based on Simple Object Access Protocol (SOAP)
    Support for REST & Plain-old Xml (POX) in .NET 3.5
  • 6. Why WCF?
    Evolution of service oriented thinking
    Remoting, Message Queuing, and ASMX were designed on different stacks
    WCF unifies the programming model for exposing services through different channels (Web, Message Queues, Sockets, In-Process)
    Service logic and function is not dependent on the channel or transport
  • 7. Key Concepts
    Service – Unit of work exposed to the world.
    Endpoint – the collection of the services address, binding, and contract.
    Address – The network location of the service(e.g., http://localhost/home/home.svc)
    Binding – How you interact with the service at the wire level.
    Channel – The transport mechanism that moves the message between service and client.
    Dispatcher – Manages execution of service code by routing messages to the appropriate service instance and method.
    Behavior – How you control the local execution of a service.
  • 8. WCF Extensibility
    WCF built for extensibility
    Base classes & interfaces provided which are the gateway to extending WCF
    Leverages dependency injection principle and factories to hook your extensions into the framework at runtime
    Support for building custom channels, bindings, etc
    Lots of “knobs and switches” to tweak WCF through configuration or code attributes
  • 9. ABC’s of WCF
  • 10. Address
    “Dude where’s my service?”
    The location of the service on the network where it can be reached.
    http://localhost/pizza.svc
    net.msmq://localhost/private/pizzaservice
    net.tcp://localhost:6000/pizzaservice
    Set via configuration or through code
  • 11. Binding
    “How do I talk to this thing?”
    The protocol and policies used to connect to the service at it’s address.
    WCF Provided Bindings
    Http(BasicHttp, WsHttp, WsDualHttp, WsFederation)
    NetMsmq
    MsmqIntegration
    NetNamedPipe
    NetTcp
    NetPeerTcp
    Set via configuration or through code
  • 12. Contract
    “What’s it going to do for me?”
    Defines the operations, inputs, outputs, and message exchange patterns of the service.
    Defined using an Interface; wired into WCF by using the ServiceContract attribute. Methods use the OperationContract attribute. Classes use the DataContract attribute and members use the DataMember attribute.
    WCF Serialization is “Opt-In”
  • 13. Hosting WCF Services
    In Process
    Windows Service
    Web Service (IIS)
    Windows Activation Services
    WAS allows you to host a service on any binding
  • 14. WCF Architecture
  • 15.
  • 16.
  • 17. Demo Service – Pizzeria Ivan
  • 18. Pizzeria Ivan
    Pizzeria Ivan has an existing application they want to service enable.
    Using WCF, build a service interface around the Pizzeria Ivan application
  • 19. If you build it…they will come.
  • 20. Some Opinion, Your Mileage May Vary
    The default WCF Service project is a good start
    Placing the contracts and service implementation in the same project creates some amount of coupling
    Following the Web Service Software Factory guidance a recommended practice is to separate the contracts and implementation
    Separating the host project leaves you open to target different hosting environments, Web, Windows Service, Windows Activation
  • 21. Pizzeria Ivan Component Architecture
  • 22. Lessons Learned
    Configuration complexity increases when using multiple services and clients in one application
    .NET 4.0 WCF is touting less configuration.
    One-way and two-way bindings require different contracts.
    One-way operations must have a void return (Sub in VB.Net)
    Very extensible but requires knowledge of WCF stack and careful implementation
    Example: Message handlers can corrupt messages if used improperly
    Out of the box you still have to do some work to build a properly scalable and maintainable service – WCF is not “drag & drop”
    To an architect this is not a bad thing!