0% found this document useful (0 votes)
19 views41 pages

WCF 4.5 Overview and Features

The document provides an overview of .NET Remoting and WCF technologies for distributed computing. It discusses the architectures, advantages and disadvantages of .NET Remoting and web services. The bulk of the document then focuses on Windows Communication Foundation (WCF) and provides details on its architecture, contracts, bindings, addresses and new features in version 4.5 like configuration simplification, contract-first development, flat WSDL and support for web sockets and UDP transport.

Uploaded by

Phuong Le
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views41 pages

WCF 4.5 Overview and Features

The document provides an overview of .NET Remoting and WCF technologies for distributed computing. It discusses the architectures, advantages and disadvantages of .NET Remoting and web services. The bulk of the document then focuses on Windows Communication Foundation (WCF) and provides details on its architecture, contracts, bindings, addresses and new features in version 4.5 like configuration simplification, contract-first development, flat WSDL and support for web sockets and UDP transport.

Uploaded by

Phuong Le
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

.NET Framework 4.

5
1

Introduction to WCF 4.5

Email: kiemhh@[Link]

Agenda
2

Overview Distributed Technologies


.NET Remoting

WebService WCF (Windows Communication Foundation)


New Features of WCF 4.5

Distributed Computer Communication


3

2012 -- WCF (.Net 4.5)

Architectures of Distributed Computing


4

2-tiers (Client Server) 3-tiers N-tiers

.NET Remoting
5

Modern day application development revolves around the distributed computing approach. Distributing computing approach involves dividing a large problem into many small parts which are solved by a number of computers . .NET Remoting is a mechanism that provides developers with a framework for objects to interact with one another across application domains whether on same physical domain or over a network

Advantages of .NET Remoting


6

.Net Remoting allows processes to share objects to call methods on and access properties of objects that are hosted in different application domains with in the same process, different processes executing on the same computer .Net Remoting supports many different communivations protocols including SOAP/HTTP protocol used by [Link] web services. Net Remoting on the other hand can share objects from any type application. .Net Remoting system is an integral part of the .NET Framework supports full .Net type system fidelity. We can pass any object across the wire to client.

Disadvantages of .NET Remoting


7

There is no security built in the .Net Remoting infrastructure the application layer.

.NET Remoting applications are tightly coupled. They rely on assembly metadata to describe types which means that any application that communivates with another must have some intimate knowledge of the others inner working. The contract between Remoting applications is the class interface. The dependence on assembly metadata implies the client applications must understand .NET concepts. As a result applications that make use of Net Remoting are not operable with other systems

Web-based Applications
8

Web-based application characteristics:


Flexibility Scalability
Reliability

Interoperability

A web-based application consists:


Presentation layer Application layer Data layer

WebService
9

A Web service is a reusable component providing services on the Web and it functions irrespective of the parties software and hardware platforms

Web Service
10

Advantages of Web Service


Allowing cross business integration Providing increased efficiency, scalability, maintainability Reducing complexity Providing on-demand integration of distributed component

Disadvantages of XML Web Service


No track of activities Security risks Mandatory XML support High deployment cost

.NET Remoting Versus Web Services


11

.NET Remoting Versus Web Services


12

.NET Framework 4.5 Architecture

What is WCF ?

WCF is a unified .NET framework for building serviceoriented applications

WCF was introduced in .NET Framework 3.0 and extended in .NET 3.5, .NET 4, and .NET 4.5
WCF is the foundation for other Microsoft distributed

technologies

Unified Programming Model

ASMX

.NET Remoting

Interop with other platforms AttributeBased Programming


Enterprise Services

Extensibility Location transparency MessageOriented Programming


[Link]

WS-* Protocol Support


WSE

WCF and The World of Services


16

WCF Architecture

Essential Pieces of WCF


18

Contracts for services, data, and messages


A contract is simply an interface declaration

Service, Data, and Message definitions


Class implementations of the contracts

Configurations declaratively

defined

programmatically

or

.Net class instances versus config files.

A host process (can be self hosted)


IIS, Windows Executable, Windows Service, or WAS

.Net Framework (4.5) Classes provide support for all of the above.

Look and Feel of WCF


19

Convergence of programming models


Just like web services Similar to .Net Remoting Sockets on steriods Hosting for local, network, and web

Communication models
Remote Procedure Call (RPC) with optional data models Message passing One way, request and (callback) reply, synchronous call

A WCF code

WCF Service Files


21

[Link]
Interface(s) that define a service, data, or message contract

[Link]
Implement the services functionality

[Link]
Markup file (with one line) used for services hosted in IIS

Configuration files that declare service attributes, endpoints, and policy


[Link] (self hosted) contains service model markup [Link] (hosted in IIS) has web server policy markup plus service model markup, as in [Link]

ABC of WCF Services

"A" stands for Addressas expressed address or uri of the endpoint. "B" stands for Bindingas expressed in the binding section, an envelope format and associated policies. "C" stands for Contractas expressed in the
portType, message and type sections and describes

types, messages, message exchange patterns and operations.

Address

The <endpoint address> is where the application endpoint lives. So when you create the client and it talks to the service using the sp,e contract, it does so at that address. Put another way, the base address is the address of the 'get wsdl' metadata endpoint, and the endpoint address is the address of the application endpoint

Binding

Bindings are used to specify the transport, encoding, and protocol details required for clients and services to communicate with each other. WCF uses bindings to generate the underlying wire representation of the endpoint, so most of the binding details must be agreed upon by the parties that are communicating

Contract

A WCF Contract is a collection of Operations that specifies what the Endpoint communicates to the outside world. Each operation is a simple message exchange. Contract can specify a Behavior Behaviors are types that modify or extend Service or Client functionality. Like the ServiceMetadata, ServiceDebug

Service serviceModel Markup


26

Contract Types

Service contracts
OperationsContract - attribute used to define the methods or

functions called in the service

Data contracts
Define which data types are passed to and from the service. WCF

defines implicit contracts for built-in types such as int and string. There are two types of Data Contracts. DataContract - attribute used to define the class
DataMember - attribute used to define the properties.

Contract Types

Fault contracts
Define which errors are raised by the service, and how the
service handles and propagates errors to its clients.

Message contracts
Allow the service to interact directly with messages. Message
contracts can be typed or untyped, and are useful in interoperability cases and when there is an existing message format we have to comply with.

Building Clients
29

Build proxy with svcutil


Visual Studio will do that if you add a service or web reference
Proxy code is in a subdirectory under the project.

Add proxy code to project Add using [Link] to client code Build and run

Other Service Behaviors


30

Throttling
Limits on number of messages, instances, and threads a service can process simultaneously

Transaction
support TransactionScope

Error handling
Options to handle, let framework handle, and report to client

Other Service Behaviors


31

Metadata
Services can be self-describing, providing MEX endpoints

Lifetime
Can specify session duration, service operations to initiate

sessions and others to terminate sessions

Security
Can specify message confidentiality, integrity, authentication,

authorization, auditing, and replay detection.

New Features of WCF 4.5 Configuration Simplification


32

WCF 4.0 simplified server config


Default endpoints
Default binding config

Default behaviors

WCF 4.5 simplfies client config


Add Service Reference only generates necessary config

New Features of WCF 4.5 Contract First


33

Implement service based on existing WSDL


Good model for interop

Useful for integration callbacks e.g. Salesforce


notification

Svcutil /sc <wsdl>

New Features of WCF 4.5

Flat WSDL
34

WCF 4.0 WSDL contains schema imports for


message definition
Can cause interop problems

Sometimes import address isnt routable


WCF 4.5 can generate flat WSDL All constructs at one Uri

[Link] address>?singleWsdl

New Features of WCF 4.5 Metro clients


35

WCF client side available for Metro applications


BasicHttpBinding , NetTcpBinding

NetHttpBinding (more on this shortly)

Proxy tuned for Metro


Only async methods Duplex methods as events

No config file
Partial method ConfigureEndpoint

New Features of WCF 4.5 WebSocket


36

[Link]
Port 80 or 443

Full duplex over single connection

WCF support
Requires Windows 8 / Windows Server 2012 [Link] Nuget package for browser based
clients

New Features of WCF 4.5 WebSocket


37

WCF 4.5 supports WebSockets in two ways:


SOAP over WebSockets (.NET) Plain text over WebSockets (browsers)

For SOAP use the NetHttpBinding For browsers, use the [Link] NuGet package
Create a service class by inheriting from WebSocketService Implement control methods - OnOpen, OnStop, OnMessage, OnError Send messages to client by calling the Send method

New Features of WCF 4.5

UDP Transport (User Datagram Protocol)


38

Connectionless Supports one-way and request-response Unicast - you do not get an exception if host is down!! Multicast messaging is supported through IP [Link] Supported features are basic
Only text encoding No sessions No security No duplex Unreliable [Link] addressing scheme

New Features of WCF 4.5 And more


39

Streaming enhancements Intergation with the Task class and async keyword [Link] compatibility more default changed Configure WCF host from code Configure intellisense and tooltips Configure validation Revised quota defaults Multiple authentication modes in IIS hosting Support for IDN (Internationalized Domain Name)

Web Links to Additional Resources

WCF 4.5 & .NET FRAMEWORK 4.5

Thank You Q&A

You might also like