24

Wcf 4.0 jump start dodn2011

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Wcf 4.0 jump start  dodn2011
Page 2: Wcf 4.0 jump start  dodn2011

WCF 4.0 Jumpstart

Chris Deweese, Senior Consultant, Daugherty Business Solutions

Page 3: Wcf 4.0 jump start  dodn2011

What the Documentation Doesn’t Tell you…

WCF has been proven to be 100% effective at defending against and repelling Zombie Hordes Creepy Girls in Horror Movies Decepticons Cobra Commander Ninja Attacks Werewolves Sith Lords Goth Kids Gingivitis

Page 4: Wcf 4.0 jump start  dodn2011

What WCF Will Not Do (Attempting these will void your warranty)

Solve all your problems Assist in Particle Acceleration Defeat Superheroes Create Skynet Your Chores Make the architect who told you to

build an SOA utopia happy (He’ll change his mind

about that later and you’ll have to rebuild it)

Page 5: Wcf 4.0 jump start  dodn2011

What is WCF? (The boring textbook version)

Windows Communication Foundation Framework for building distributed

applications Unified programming model for

different communication channels (web, sockets, message queues, etc)

Brings together elements from Remoting, ASMX Web Services, Messaging

Page 6: Wcf 4.0 jump start  dodn2011

Why Would I use WCF?

Web Services (SOAP & REST) Distributed Communication

(Messaging – message queues/sockets)

Intra-process communication (Processes on one machine)

Page 7: Wcf 4.0 jump start  dodn2011

Key Concepts Service – Unit of work exposed to the world. 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. Endpoint – the collection of the services address,

binding, and contract. 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.

Page 9: Wcf 4.0 jump start  dodn2011

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

Page 10: Wcf 4.0 jump start  dodn2011

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

Page 11: Wcf 4.0 jump start  dodn2011

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”

Page 12: Wcf 4.0 jump start  dodn2011

Hosting WCF Services

In Process Windows Service Web Service (IIS) Windows Activation Services

WAS allows you to host a service on any binding

Page 13: Wcf 4.0 jump start  dodn2011

WCF Architecture

Page 14: Wcf 4.0 jump start  dodn2011
Page 15: Wcf 4.0 jump start  dodn2011
Page 16: Wcf 4.0 jump start  dodn2011

What’s new in WCF 4?

Simplified configurationSimplified configurationSimplified. Configuration.

Page 17: Wcf 4.0 jump start  dodn2011

What else is new in WCF 4? WS-Discovery protocol

implementation Used to discover services on the network

Routing service Used to route messages based on

content or other rules you specify REST Improvements

Enhancements to simplify REST service development

Page 18: Wcf 4.0 jump start  dodn2011

Let’s Build a Service

Less talk. More code. Demo: BasicHttp Service

Page 19: Wcf 4.0 jump start  dodn2011

Let’s get some REST

Drop the soap. Demo: Add REST endpoint to existing

service

Page 20: Wcf 4.0 jump start  dodn2011

Hands-free with Default Endpoints

Look Ma’ No Configuration Demo: Hosting BasicHttp, Net.Tcp,

and REST in one Application

Page 21: Wcf 4.0 jump start  dodn2011

Where do you want to go today? Routing Service Demo: Sports & Concert ticket

services (Created by Richard Seroter http://bit.ly/cdHp7U)

Page 22: Wcf 4.0 jump start  dodn2011

Why WCF 4 is Neat-o

Aka “Summary” Simplified configuration through

default endpoints Simplified coding model for REST

services (uses ASP.NET 4 routing) New features – Discovery & Routing

Page 23: Wcf 4.0 jump start  dodn2011

Questions/Discussion

Page 24: Wcf 4.0 jump start  dodn2011