WCF made easy with Microsoft .NET Framework 4 and Windows Server AppFabric

24

description

This is from my Tech-Ed Africa 2010 talk. For more information see: http://www.sadev.co.za/content/teched-africa-2010-slides-scripts-and-demos-my-talks This session looks at what is new in WCF 4 to make our lives easier and how AppFabric brings that all together and makes it easier to deploy and manage.

Transcript of WCF made easy with Microsoft .NET Framework 4 and Windows Server AppFabric

Page 1: WCF made easy with Microsoft .NET Framework 4 and Windows Server AppFabric
Page 2: WCF made easy with Microsoft .NET Framework 4 and Windows Server AppFabric

Robert MacLeanTechnology SpecialistBB&D

WCF Made Easy with .NET 4 & Windows Server AppFabric

Page 3: WCF made easy with Microsoft .NET Framework 4 and Windows Server AppFabric

3

Who am I?

Robert MacLeanMicrosoft ALM MVPMicrosoft ALM RangerProud Community Lead

Information WorkerS.A. Architect

www.sadev.co.za@rmaclean

Page 4: WCF made easy with Microsoft .NET Framework 4 and Windows Server AppFabric

4

Overture

Level 300What is new in WCF 4 to make it easy?What is AppFabric?WCF + AppFabric = Easy

Warning: Excessive use of implicit, explicit and angle brackets ahead

Page 5: WCF made easy with Microsoft .NET Framework 4 and Windows Server AppFabric

5

The big picture of WCF 4

What is new?Configuration defaults, default endpointsWorkflow ServicesHigh performance tracing with ETWNew features for REST-based servicesQueued messaging enhancementsNew protocols

Basic Profile 1.2WS-Discovery and DiscoveryService

RouterServiceNew DataContractResolver, extensibility

Page 6: WCF made easy with Microsoft .NET Framework 4 and Windows Server AppFabric

6

My thoughts on WCF

WCF is hardCompared to ASMXConfiguration

BindingsEndpoints

Page 7: WCF made easy with Microsoft .NET Framework 4 and Windows Server AppFabric

7

Building ServicesASMX

Write class, add attribute

Expose web methods

Just work with POCO“old” WCF

Interface + Attribute

Write class, add attribute

Data Contracts

Config

Config Fixes

WCF Sexy

Interface + Attribute

Write class, add attribute

Just work with POCO

Page 8: WCF made easy with Microsoft .NET Framework 4 and Windows Server AppFabric

WCF Sexy

Demo

Page 9: WCF made easy with Microsoft .NET Framework 4 and Windows Server AppFabric

9

Protocol Mappings

<protocolMapping> <clear /> <add scheme="http" binding="basicHttpBinding" bindingConfiguration="" /> <add scheme="net.tcp" binding="netTcpBinding" bindingConfiguration="" /> <add scheme="net.pipe" binding="netNamedPipeBinding" bindingConfiguration="" /> <add scheme="net.msmq" binding="netMsmqBinding" bindingConfiguration="" /> </protocolMapping> Start with this

Eg: http://demo

This is your binding

Default binding config!!!

Page 10: WCF made easy with Microsoft .NET Framework 4 and Windows Server AppFabric

10

Default Endpoints & Hosts

Self HostSupply base address via code or configExplicit: ServiceHost.AddDefaultEndPoints() Implicit: ServiceHost.Open()

IISBase address is .svc endpointHTTP protocol is provided by defaultProtocols can be added in IIS Manager

Page 11: WCF made easy with Microsoft .NET Framework 4 and Windows Server AppFabric

11

Are Default Endpoints A Good Thing?

Designed to cater for the current majorityYou may be special

Quota issuesWSHttp or WebHttpMEXLimiting which contracts on which protocols

You can override in machine.config (bad – mostly) or app.config (better – mostly)

Page 12: WCF made easy with Microsoft .NET Framework 4 and Windows Server AppFabric

12

Refined Default Config<system.serviceModel> <behaviors> <serviceBehaviors> <behavior> <serviceMetadata httpGetEnabled="true"/> <serviceDebug includeExceptionDetailInFaults="false"/> </behavior> </serviceBehaviors> </behaviors> <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /></system.serviceModel>

Page 13: WCF made easy with Microsoft .NET Framework 4 and Windows Server AppFabric

13

POCO BEFORE .NET 3.5 SP1[DataContract]public class User{ [DataMember] public string FirstName { get; set; } [DataMember] public string LastName { get; set; } [DataMember] public string Username { get; set; } public string Password { get; set; } // do not share}

Explicit

Page 14: WCF made easy with Microsoft .NET Framework 4 and Windows Server AppFabric

14

POCO FROM .NET 3.5 SP1public class User { public string FirstName { get; set; } public string LastName { get; set; } public string Username { get; set; } [IgnoreDataMember] public string Password { get; set; } // do not share}

IMPLICIT

Page 15: WCF made easy with Microsoft .NET Framework 4 and Windows Server AppFabric

15

Been to my other talks?

Page 16: WCF made easy with Microsoft .NET Framework 4 and Windows Server AppFabric

16

A rose by any other name…

Windows Server AppFabric Contains two key componentsHosting

EndPoint, Windows App Server Extensions, DublinCaching

VelocityNot to be confused with Azure AppFabric

Page 17: WCF made easy with Microsoft .NET Framework 4 and Windows Server AppFabric

17

N.B. AppFabric

Requires .NET 4 on ServerApplications for not need .NET 4, depends on features

Standalone download or Web Platform InstallerHigh Availability is only in Windows Server 2008 Enterprise & Data Centre

Page 18: WCF made easy with Microsoft .NET Framework 4 and Windows Server AppFabric

18

Windows Server AppFabric Architecture

Windows Activation Services

.NET Framework SQL Server Tooling

IIS

Windows Server AppFabric

WCF

WF

ASP.

NET

Visu

al

Stud

io

SCO

M

Pow

erSh

ell

Logging

Event Tracing for Windows

Pers

isten

ce

Mon

itorin

g

Cach

ing

Page 19: WCF made easy with Microsoft .NET Framework 4 and Windows Server AppFabric

AppFabric + WCF = Easy

Demo

Page 20: WCF made easy with Microsoft .NET Framework 4 and Windows Server AppFabric

20

Summary

WCF 4 can be as easy as ASMXFor majority of simple scenariosAbility to break the mould is there

AppFabric & WCFThe tools to configure and manage servicesScalable, manageable solution for hosting services on Windows

Page 21: WCF made easy with Microsoft .NET Framework 4 and Windows Server AppFabric

21

[email protected] @rmaclean

Meet me at the community lounge

Page 22: WCF made easy with Microsoft .NET Framework 4 and Windows Server AppFabric

22

Resources

www.microsoft.com/teched

Sessions On-Demand & Community Microsoft Certification & Training Resources

Resources for IT Professionals Resources for Developers

www.microsoft.com/learning

http://microsoft.com/technet http://microsoft.com/msdn

Learning

SMS [ Your Name ] and the word “AppServer” to 41491Need more Information?

Page 23: WCF made easy with Microsoft .NET Framework 4 and Windows Server AppFabric

Complete an evaluation via CommNet and Tag to win amazing prizes!

Page 24: WCF made easy with Microsoft .NET Framework 4 and Windows Server AppFabric

© 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED

OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.