congyu li software developer...

44

Upload: others

Post on 05-Apr-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Congyu Li Software Developer Engineerdownload.microsoft.com/documents/hk/technet/techdays2009/... · 2018-12-05 · Congyu Li Software Developer Engineer Quoc Bui Senior Program Manager
Page 2: Congyu Li Software Developer Engineerdownload.microsoft.com/documents/hk/technet/techdays2009/... · 2018-12-05 · Congyu Li Software Developer Engineer Quoc Bui Senior Program Manager

Congyu LiSoftware Developer EngineerQuoc BuiSenior Program Manager

Company: MicrosoftSession Code: DEV 320

Page 3: Congyu Li Software Developer Engineerdownload.microsoft.com/documents/hk/technet/techdays2009/... · 2018-12-05 · Congyu Li Software Developer Engineer Quoc Bui Senior Program Manager

Agenda

WCF 4.0 Overview

WCF 4.0 – Simplified Configuration

WCF 4.0 – Service Discovery

WCF 4.0 – Routing Service

WCF 4.0 – Improved REST Support

Summary

Page 4: Congyu Li Software Developer Engineerdownload.microsoft.com/documents/hk/technet/techdays2009/... · 2018-12-05 · Congyu Li Software Developer Engineer Quoc Bui Senior Program Manager

WCF 4.0

Simplified developer experience

Enables new scenarios/features

Fairly minor in terms of impact to your applications

WCF 4.0:

Page 5: Congyu Li Software Developer Engineerdownload.microsoft.com/documents/hk/technet/techdays2009/... · 2018-12-05 · Congyu Li Software Developer Engineer Quoc Bui Senior Program Manager

New WCF 4.0 Features

Simplified configuration

Service Discovery

Router Service

Improved REST support

Page 6: Congyu Li Software Developer Engineerdownload.microsoft.com/documents/hk/technet/techdays2009/... · 2018-12-05 · Congyu Li Software Developer Engineer Quoc Bui Senior Program Manager
Page 7: Congyu Li Software Developer Engineerdownload.microsoft.com/documents/hk/technet/techdays2009/... · 2018-12-05 · Congyu Li Software Developer Engineer Quoc Bui Senior Program Manager

Simplified Configuration

New support for default service configurationsDefault binding & behavior configurations

Implicit endpoint configurations

Much easier to get services up and runningRemoves the need for <service> configuration

Also enables file-less activation (no .svc)

Page 8: Congyu Li Software Developer Engineerdownload.microsoft.com/documents/hk/technet/techdays2009/... · 2018-12-05 · Congyu Li Software Developer Engineer Quoc Bui Senior Program Manager

Example : Configuration for WCF Web Services

EndpointA: http://localhost/service/ICalculator/MEXB: mexHttpBindingC: IMetadataExchange

machine.configC:\Windows\Microsoft.NET\Framework\v4.0.11125\Config

<system.serviceModel>

<bindings>

<wsHttpBinding>

<binding name=""/>

</wsHttpBinding>

</bindings>

<behaviors>

<service>

<behavior name="">

<serviceMetadata

httpGetEnabled="true" />

</behavior>

<service>

<behaviors>

<system.serviceModel>

<bindings>

<wsHttpBinding>

<binding/>

</wsHttpBinding>

</bindings>

<behaviors>

<service>

<behavior>

<serviceMetadata

httpGetEnabled="true" />

</behavior>

<service>

</behaviors>

Host

(Root) web.configC:\Windows\Microsoft.NET\Framework\v4.0.11125\Config

EndpointA: http://localhost/service/ICalculatorB: WSHttpBindingC: ICalculator

IIS Metabase

Enabled Protocols: HTTPBaseAddress:http://localhost/service

IIS vdir (/localhost/Service)

Service.svcService.dll

Default Behavior

Default Binding

web.config/localhost/development

<system.serviceModel>

<behaviors>

<service>

<behavior>

<serviceDebug/>

</behavior>

<service>

</behaviors>

No web.config

Default Behavior

Page 9: Congyu Li Software Developer Engineerdownload.microsoft.com/documents/hk/technet/techdays2009/... · 2018-12-05 · Congyu Li Software Developer Engineer Quoc Bui Senior Program Manager

Example : Configuration for WCF Web Services

WCF 3.5

9

WCF 4.0

Page 10: Congyu Li Software Developer Engineerdownload.microsoft.com/documents/hk/technet/techdays2009/... · 2018-12-05 · Congyu Li Software Developer Engineer Quoc Bui Senior Program Manager

Simplified Configuration

Page 11: Congyu Li Software Developer Engineerdownload.microsoft.com/documents/hk/technet/techdays2009/... · 2018-12-05 · Congyu Li Software Developer Engineer Quoc Bui Senior Program Manager
Page 12: Congyu Li Software Developer Engineerdownload.microsoft.com/documents/hk/technet/techdays2009/... · 2018-12-05 · Congyu Li Software Developer Engineer Quoc Bui Senior Program Manager

Discovery Overview

Motivations…Applications are dynamic and composite in nature

Multiple types of components involved

It is difficult to find existing service assets

Page 13: Congyu Li Software Developer Engineerdownload.microsoft.com/documents/hk/technet/techdays2009/... · 2018-12-05 · Congyu Li Software Developer Engineer Quoc Bui Senior Program Manager

WCF Discovery

Framework component

Ships as a DLLProxyServiceClient

Query forServices

Listen forAnnouncements Announce

Respond to Queries

Listen forAnnouncements

Respond toQueries

Page 14: Congyu Li Software Developer Engineerdownload.microsoft.com/documents/hk/technet/techdays2009/... · 2018-12-05 · Congyu Li Software Developer Engineer Quoc Bui Senior Program Manager

Service Discovery

WCF 4.0 provides two types of service discovery

Clients can discover services on a local subnet (UDP-based)

Clients can discover services on a larger "managed" network (beyond the local subnet) through a discovery proxy

Ad-Hoc Managed

Enabled via the serviceDiscovery behavior,clients "discover" services using a DynamicEndpoint

Page 15: Congyu Li Software Developer Engineerdownload.microsoft.com/documents/hk/technet/techdays2009/... · 2018-12-05 · Congyu Li Software Developer Engineer Quoc Bui Senior Program Manager

Ad-Hoc Discovery

WCF ClientApplication

Billing Service

OrderService

Invoice ProcessingService

Order ServiceLocated

Invoice Processing

Service Located

Page 16: Congyu Li Software Developer Engineerdownload.microsoft.com/documents/hk/technet/techdays2009/... · 2018-12-05 · Congyu Li Software Developer Engineer Quoc Bui Senior Program Manager

Managed Discovery

WCF Client Application

Discovery Proxy

InvoiceProcessingService

Billing Service

Invoice Processing Persisted ServiceBilling Service

Billing ServiceLocated

Page 17: Congyu Li Software Developer Engineerdownload.microsoft.com/documents/hk/technet/techdays2009/... · 2018-12-05 · Congyu Li Software Developer Engineer Quoc Bui Senior Program Manager

Client Operations

Search for services based on criteriaService Contract

Scopes

Extensions

Dynamic Endpoint of Discovery Client

Host Announcement Service

Page 18: Congyu Li Software Developer Engineerdownload.microsoft.com/documents/hk/technet/techdays2009/... · 2018-12-05 · Congyu Li Software Developer Engineer Quoc Bui Senior Program Manager

Service Operations

Enable Service DiscoveryAllows the service to listen for and respond to discovery messages

Announcements

Customizations:Discoverability of individual endpoints

Decorate Endpoints with scopes

Extensions

Page 19: Congyu Li Software Developer Engineerdownload.microsoft.com/documents/hk/technet/techdays2009/... · 2018-12-05 · Congyu Li Software Developer Engineer Quoc Bui Senior Program Manager

Discovery Proxy

Facilitates Managed ModeResponds to discovery messages:

Find, Announcements, etc…

“Discovery Head” on your custom repository

Base Classes Provided

Page 20: Congyu Li Software Developer Engineerdownload.microsoft.com/documents/hk/technet/techdays2009/... · 2018-12-05 · Congyu Li Software Developer Engineer Quoc Bui Senior Program Manager

Benefits of Service Discovery

Reduced Maintenance Costs

Robust Applications

Scale

Page 21: Congyu Li Software Developer Engineerdownload.microsoft.com/documents/hk/technet/techdays2009/... · 2018-12-05 · Congyu Li Software Developer Engineer Quoc Bui Senior Program Manager

Service Discovery based on WS-Discovery

Page 22: Congyu Li Software Developer Engineerdownload.microsoft.com/documents/hk/technet/techdays2009/... · 2018-12-05 · Congyu Li Software Developer Engineer Quoc Bui Senior Program Manager
Page 23: Congyu Li Software Developer Engineerdownload.microsoft.com/documents/hk/technet/techdays2009/... · 2018-12-05 · Congyu Li Software Developer Engineer Quoc Bui Senior Program Manager

Why build an intermediary?

Service Aggregations

Versioning

Protocol bridging

Application Load-balancing

Service Bus

Page 24: Congyu Li Software Developer Engineerdownload.microsoft.com/documents/hk/technet/techdays2009/... · 2018-12-05 · Congyu Li Software Developer Engineer Quoc Bui Senior Program Manager

Challenges

When writing an intermediary you have to think about:

Transactions

Security

Error handling

Multicast v. Unicast

SOAP v. REST

Dynamic Environments

Reliability, Availability, and Performance

Page 25: Congyu Li Software Developer Engineerdownload.microsoft.com/documents/hk/technet/techdays2009/... · 2018-12-05 · Congyu Li Software Developer Engineer Quoc Bui Senior Program Manager

WCF Router CapabilitiesContent Based Routing

MessageFilters

MessageFilterTable

SOAP Headers

Xpath

Protocol Binding

System Provided Bindings

Error Handling

CommunicationException & TimeOut

Error Path Definition

“On failure, resend to:”

Dynamic Reconfiguration

On Event, rebuild rules/destination set

Don’t disrupt in-flight messages/sessions

Page 26: Congyu Li Software Developer Engineerdownload.microsoft.com/documents/hk/technet/techdays2009/... · 2018-12-05 · Congyu Li Software Developer Engineer Quoc Bui Senior Program Manager

Example : Error Handling & Protocol Bridging

CalcClient

Backup

RoutingService

WS-HttpNet.Tcp

ICalcService

Page 27: Congyu Li Software Developer Engineerdownload.microsoft.com/documents/hk/technet/techdays2009/... · 2018-12-05 · Congyu Li Software Developer Engineer Quoc Bui Senior Program Manager

Example:Complex Filters

Calc

Client

RoundICalc

Routing

Service

RegularICalc

Filter Rules Priority

If (has header) Round ICalc 2

If (showed up on Ep2) Regular ICalc 1

If (showed up w/ Address 2) Round ICalc 1

If (RoundRobin1) Regular ICalc 0

If (RoundRobin2) Round ICalc 0

Page 28: Congyu Li Software Developer Engineerdownload.microsoft.com/documents/hk/technet/techdays2009/... · 2018-12-05 · Congyu Li Software Developer Engineer Quoc Bui Senior Program Manager

Example : Dynamic Reconfiguration

Calc

Client

Round

ICalc

Routing

Service

Regular

ICalc

Page 29: Congyu Li Software Developer Engineerdownload.microsoft.com/documents/hk/technet/techdays2009/... · 2018-12-05 · Congyu Li Software Developer Engineer Quoc Bui Senior Program Manager

Example:Advanced Error Handling

Service Queues

RoutingServiceInQ

Pri

mar

y

bac

kup

Logging Queues

Pri

mar

y

bac

kup

DLQ

Page 30: Congyu Li Software Developer Engineerdownload.microsoft.com/documents/hk/technet/techdays2009/... · 2018-12-05 · Congyu Li Software Developer Engineer Quoc Bui Senior Program Manager

Routing Service

Page 31: Congyu Li Software Developer Engineerdownload.microsoft.com/documents/hk/technet/techdays2009/... · 2018-12-05 · Congyu Li Software Developer Engineer Quoc Bui Senior Program Manager
Page 32: Congyu Li Software Developer Engineerdownload.microsoft.com/documents/hk/technet/techdays2009/... · 2018-12-05 · Congyu Li Software Developer Engineer Quoc Bui Senior Program Manager

New Features

Simplified Development:•Simplified Config•ASP.NET Routes

Simplified Programming:•No [OperationContract]•WebFaultException

Simplified Consumption:•Help Page

Formatting:•Automatic XML/JSON•Content Nego API•Multiple Formats

Caching:•ASP.NET Output Cache•Conditional GET & PUT

AJAX:•JSONP

Page 33: Congyu Li Software Developer Engineerdownload.microsoft.com/documents/hk/technet/techdays2009/... · 2018-12-05 · Congyu Li Software Developer Engineer Quoc Bui Senior Program Manager

Simplified Development

Simplified ConfigurationDefault standard Endpoint

Customizable standardEndpoint

ASP.Net RoutesUsage Example Simplified Development:

•Simplified Config•ASP.NET Routes

Page 34: Congyu Li Software Developer Engineerdownload.microsoft.com/documents/hk/technet/techdays2009/... · 2018-12-05 · Congyu Li Software Developer Engineer Quoc Bui Senior Program Manager

Formatting

Automatic XML/JSONBased on request header : Accepts/Content-Type

Scenario of specifying XML/JSONFormatting:

•Automatic XML/JSON•Content Nego API•Multiple Formats

Page 35: Congyu Li Software Developer Engineerdownload.microsoft.com/documents/hk/technet/techdays2009/... · 2018-12-05 · Congyu Li Software Developer Engineer Quoc Bui Senior Program Manager

Example:Automatic XML/JSON

35

Page 36: Congyu Li Software Developer Engineerdownload.microsoft.com/documents/hk/technet/techdays2009/... · 2018-12-05 · Congyu Li Software Developer Engineer Quoc Bui Senior Program Manager

Caching Support

ASP.NET caching

Conditional GET/PUT

Caching:•ASP.NET Output Cache•Conditional GET & PUT

Page 37: Congyu Li Software Developer Engineerdownload.microsoft.com/documents/hk/technet/techdays2009/... · 2018-12-05 · Congyu Li Software Developer Engineer Quoc Bui Senior Program Manager

Simplified Consumption

Automatically generating help pageGenerate XHTML help page for each service, including URL and message example

Simplified Consumption:•Help Page

Page 38: Congyu Li Software Developer Engineerdownload.microsoft.com/documents/hk/technet/techdays2009/... · 2018-12-05 · Congyu Li Software Developer Engineer Quoc Bui Senior Program Manager

AJAX

JSONPDefault callback property

Customized callback property

AJAX:•JSONP

Page 39: Congyu Li Software Developer Engineerdownload.microsoft.com/documents/hk/technet/techdays2009/... · 2018-12-05 · Congyu Li Software Developer Engineer Quoc Bui Senior Program Manager

Improved REST Support

Page 40: Congyu Li Software Developer Engineerdownload.microsoft.com/documents/hk/technet/techdays2009/... · 2018-12-05 · Congyu Li Software Developer Engineer Quoc Bui Senior Program Manager

Summary

New in 4.0Simplified developer experience

Enables new scenarios/features

Page 41: Congyu Li Software Developer Engineerdownload.microsoft.com/documents/hk/technet/techdays2009/... · 2018-12-05 · Congyu Li Software Developer Engineer Quoc Bui Senior Program Manager
Page 42: Congyu Li Software Developer Engineerdownload.microsoft.com/documents/hk/technet/techdays2009/... · 2018-12-05 · Congyu Li Software Developer Engineer Quoc Bui Senior Program Manager

Resources

Learning and Downloads:WF 3.x: http://msdn.microsoft.com/workflowWF 4: http://msdn.microsoft.com/workflow/future/WCF 3.x: http://msdn.microsoft.com/wcfWCF 4: http://msdn.microsoft.com/wcf/future

To ask questions:http://social.msdn.microsoft.com/forums/en-US/wcfhttp://social.msdn.microsoft.com/Forums/en-US/wcfprereleasehttp://social.msdn.microsoft.com/forums/en-US/windowsworkflowfoundationhttp://social.msdn.microsoft.com/Forums/en-US/wfprerelease

To provide Suggestions:https://connect.microsoft.com/wfhttps://connect.microsoft.com/wcf

Resources for .Net(Documents, Samples, Demos etc.)http://dotnet

Page 43: Congyu Li Software Developer Engineerdownload.microsoft.com/documents/hk/technet/techdays2009/... · 2018-12-05 · Congyu Li Software Developer Engineer Quoc Bui Senior Program Manager

© 2009 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.

Page 44: Congyu Li Software Developer Engineerdownload.microsoft.com/documents/hk/technet/techdays2009/... · 2018-12-05 · Congyu Li Software Developer Engineer Quoc Bui Senior Program Manager

Client DMZDe-Militarized Zone

DMZ (inner) Internal

Internet Browser

Web Service

(IIS)

Reverse Proxy(ISA)

Load Balancer

Application Server

(WCF, BTS, WF)

Application Server

(WCF, BTS, WF)

Application Server

(WCF, BTS, WF)

192.168.0.1

59.188.192.36 65.55.17.25Externally exposed IP address

200.200.200.1translator

200.200.200.2Internal IP address

20

0.2

00

.20

0.1

02

00

.20

0.2

00

.11

20

0.2

00

.20

0.1

2