wcf intro
Download
Skip this Video
Download Presentation
WCF Intro

Loading in 2 Seconds...

play fullscreen
1 / 21

WCF Intro - PowerPoint PPT Presentation


  • 102 Views
  • Uploaded on

WCF Intro. Scott Reed Owner - Brain Hz Software scott@brainhzsoftware.com Instructor – DevelopMentor scottr@develop.com. Agenda. Why WCF? Architecture Programmatic client and service Moving to configuration Sharing contracts Summary. Before WCF.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' WCF Intro' - beverly-baldwin


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
wcf intro

WCF Intro

Scott Reed

Owner - Brain Hz Software

scott@brainhzsoftware.com

Instructor – DevelopMentor

scottr@develop.com

agenda
Agenda
  • Why WCF?
  • Architecture
  • Programmatic client and service
  • Moving to configuration
  • Sharing contracts
  • Summary
before wcf
Before WCF

Clearly not an enabling technology, instead it is unifying

wcf design goal
WCF Design goal
  • Design goal:
    • To be the best way to get any two pieces of software to communicate under any circumstances
  • To achieve this had to abstract communication
    • Services are programs that exchange messages
    • Lower layer sends messages through channels
messages
Messages
  • Packaged data
  • Abstraction of a SOAP message
    • Xml InfoSetnot actually XML
  • Created using factory method
    • Message.CreateMessage
channels
Channels
  • Channel transmit those messages
  • Channels together form a stack
  • Protocol channels can be layered on top
    • Provide services like reliability and security
  • Encoder changes Message to byte[]
  • Transport channel actually sends the bytes
channel stack
Channel Stack

Protocol

Protocol

Protocol

Protocol

Encoder

Encoder

óöu»×{ÊêCÌã³û¢Ì\ÓÒÐ(02

óöu»×{ÊêCÌã³û¢Ì\ÓÒÐ(02

Transport Channel

Transport Channel

programming in the channel layer
Programming in the Channel Layer

void ChannelListen()

{

IChannelListener<IReplyChannel> listener = GetListener();

listener.Open();

while (listener.WaitForChannel())

{

IReplyChannel channel = listener.AcceptChannel();

channel.Open();

RequestContext request = channel.ReceiveRequest();

Message reply = HandleMessage(request.RequestMessage);

request.Reply(reply);

request.Close(); channel.Close();

  }

}

  • Explicit message passing like in sockets or MSMQ
    • What happened to easy?
service model layer
Service Model Layer
  • Sits on top of Channel Layer and hides it
  • Allows method invocation of strongly typed parameters
  • Uses serialization to translate objects into messages
the big picture
The Big Picture

service object

proxy

dispatcher

Service Model

Layer

serializer

serializer

Channel Layer

protocol

protocol

protocol

protocol

encoder

encoder

transport

transport

endpoint
Endpoint
  • Clients talk to endpoints, and services expose endpoints
  • Address
  • Binding
  • Contract
slide12

Client

Service

C

C

C

C

C

B

B

B

B

B

A

A

A

A

A

Service

wcf in all its glory
WCF in all its glory

wsHttpBinding

(featurerich)

netTcpBinding

(performance)

Business Partner

basicHttpBinding

(compatibility)

webHttpBinding

(AJAX, JSON…)

Customer

netMsmqBinding

(batchprocessing)

netNamedPipeBinding

(local, fast)

Browser

hosting
Hosting
  • Need something to listen for incoming connections (a host)
  • WCF is host independent (by default)
  • Self host (Console, NT Service, Forms/WPF App)
    • Use the ServiceHost class (Open and Close)
  • IIS/WAS hosted
    • Use a .svc file (just like ASMX)
  • WCF provided host for testing *
    • WcfServiceHost
step by step
Step by step
  • Define the contract
  • Implement the contract
  • Host the service
  • Expose endpoints
  • Optionally expose metadata
slide16
Demo
  • Writing a programmatic client and a service
configuration
Configuration
  • Why do it in config?
    • So you don’t have to recompile
  • Everything you do in code can be done in config (almost)
demo revisited
Demo (revisited)
  • Changing to a config file
sharing contracts
Sharing contracts
  • Both the client and the service need to know the types and methods listed in the contract
  • There are two ways to accomplish this:
    • Share types (ala Remoting)
    • Share schema (ala ASMX)
demo revisited again
Demo (revisited again)
  • Exposing metadata (base and explicit)
  • Generating a proxy
summary
Summary
  • WCF unifies communications technology
  • Architected in two layers:
    • Channel layer and Service Model layer
  • Endpoints are ABCs
  • Two ways to share contract (type and schema)
ad