SlideShare uma empresa Scribd logo
1 de 62
Baixar para ler offline
WCF
Maxime Lemaitre – 30/04/2013
• Introduction
• Basic Concepts
• Going deeper
• What's New in WCF 4/4.5
• Best Practices
• WCF Tools
• Use Cases
2
Agenda
yes, we can !
• I won’t explain you every concepts & components of WCF 
• I will try to educate you to common WCF features and give you some best
practices
• I have included as many links as possible
3
Introduction
Objectives
• WCF (CodeName Indigo) is a unified communication framework in.NET for
building connected, service-oriented applications
• Introduced in .Net 3.0
– Before WCF : ASMX, Remoting, TcpServer, COM, POX…
• Defines a common programming model and unified API for clients and
services to send messages between each other
• Key characteristics
– Service-oriented programming model (SOA):
• Services are offered on an endpoint.
• WCF completely separates service hosting, endpoints and services
– Interoperability with non-WCF web services due to use of SOAP messages
• WCF implements many of the WS-* standards
– Extensibility
• WCF client / server can be configured to interoperate with REST, ATOM-
feeds, plain XML or JSON messages
4
Introduction
Why WCF ?
• To expose our first WCF service, we need
– An Endpoint (WCF’s ABC)
– A Service Implementation
– Some Config
– An Hosting Environnment
5
How to build our first WCF Service
(a very basic service )
• Address : « Where is my service ? »
– The location of the service on the network where it can be reached
• Some examples
– http://localhost/calculatorservice.svc
– net.msmq://localhost/private/calculatorservice
– net.tcp://localhost:6000/calculatorservice
• Set via configuration/code or inherited from Hosting Environment
6
ABC’s of WCF
Give me the A !
• Binding : « How do I talk to this thing? »
– The protocol/policies/settings used to connect to the service at it’s address
• Some examples
– Http(BasicHttp, WsHttp, WsDualHttp, WsFederation)
– NetMsmq
– NetNamedPipe
– NetTcp
– CustomBinding
– …
• Contains
– Transport protocol (HTTP, TCP, MSMQ, …)
– Message encoding (MTOM, XML, JSON, Binary, …)
– Security / reliability settings (encryption & authentication)
– …
• All system provided binding are available here
7
ABC’s of WCF
Give me the B !
• A Binding is an aggregate of micro WCF features
– Security, Duplex, Session, Encoding, Streaming, …
8
ABC’s of WCF
Give me the B !
• Contract : « What’s it going to do for me? »
– Defines the operations, inputs, outputs, and mep of the service.
• In WCF, a Contract is defined by an interface
• A Contract defines
– Grouping of operations in a service => .Net attribute [ServiceContract]
– Signature of operations => .Net attribute [OperationContract]
– Data types of operations => .Net attribute [DataContract]
9
ABC’s of WCF
Give me the C !
10
Our first WCF Service
on the road to Carl …
• Services are designed to run in any Windows process that supports managed
code
– Hosting Options
• Self-Hosting Fast & Flexible but not an enterprise solution
• Windows Service Secure, Supported by all windows but lack of reliable features
• IIS/WAS Components required but all advantages of IIS
• IIS7 (Vista/WS2K8) introduced Windows Activation Service (WAS)
– Host non HTTP protocols in IIS like Net.Tcp, NamedPipe, MSMQ…
• Continue reading here
11
WCF Hosting
How & where do I host my new WCF service ?
IIS Hosting
12
WCF Hosting
examples
Self- Hosting
• A WCF client is used to invoke a WCF Service
– It’s not mandatory but will help you a lot (create SOAP manually ?)
– Translate .Net code to SOAP and vice-versa
– Logic-less implementation of Proxy Design Pattern
• To create a WCF client, you need
– An Address
– A Binding
– A Contract
– Some code
– (extra configuration & settings)
• Clients have to be stateless and disposed when required
13
How to call this Service ?
WCF Clients
• An Automatic WCF Client in 2 clics
• Generate all client code, contract & configuration.
• Best suite if you don’t know the contract
14
WCF Clients
example #1 : Service Reference
• A little more code
• Perfect if you already know the
contract
15
WCF Clients
example #2 : ChannelFactory<T>
• WCF allows use to expose Metadata using standardized protocols
– Metadata ?
• Operations a client perform
• The structure of the data types that the operations work with or return
• Definitions of all the endpoints implemented by the service and the various
options needed for each such as security
=> Basically, how to call the service
• Two ways to expose Metadata
– Mex Endpoint (for all services/bindings)
– Wsdl/Disco (only for http Services)
• Metadata is generally not exposed for production public service
• More info here
16
WCF Metadata
what is it ?
Http(s)GetEnabled
17
WCF Metadata
how to publish metadata
IMexdataExchange
• WCF Supports 3 MEPs
– OneWay
Client sends a message using a fire and forget exchange. Like
UDP, it does not guarantee that the remote endpoint has received
the message . Defined at operation level. Warning : it’s not async !
– Request-Reply (Default)
Client sends a message to a WCF Service and then waits for a reply
(no response = TimeOutException). Client stops processing until the
return message is received. Classic pairs of Request-Response like
in HTTP GET method.
– Duplex
Like a phone conversation, both sides can send and receive
messages. Defined at contract level.
• Continue reading here
18
WCF Messaging
Message Exchange Patterns (MEP)
• In Connected Systems, there is no magic translation and data needs to be
exchanged in a serialized form
• WCF provides 2 Serializer
– DataContractSerializer Opt-in Serialization
• DataContract or Message Contract
– XmlSerializer Opt-out Serialization
=> 2 Serializers to handle all scenarios
• There are also many ways to by-pass serialization
– Using Stream object (for Streaming and Large Data)
– Using Message class (Parsing Soap Message directly)
• More info here
19
WCF Serialization
hidden part
20
WCF Serialization
examples
DataContractSerializer
(DataContract)
DataContractSerializer
(MessageContract)
XmlSerializer
• Scope of WCF Security
– Transfer security
Responsible for providing message confidentiality, data integrity, and authentication of
communicating parties
– Authorization
Responsible for providing a framework for making authorization decisions
– Auditing
Responsible for logging security-related events to the audit log
• Basically WCF Security is managed by Security Configuration
– None
– Transport
– Message
– Both
– TransportWithMessageCredential or TransportCredentialOnly
• All bindings don’t provide the same security features !
• Continue reading here and here
21
WCF Security
do not fear …
Transport Security
User credentials and claims are
passed using the transport layer
 Interoperabable
 Performant & Hardware Accelerated
o Transport-dependant
o Limited set of credentials
o Point to Point com only
22
WCF Security
Message Vs Transport Security
Message Security
User credentials and claims are
encapsulated in every message using
the WS-Security specification
 end-to-end security
 Partial/selective encryption and signing
 Transport-independent
o Limited interoperability (WS-Security)
o Less performant
• Sessions
– A session is a correlation of all messages sent between two endpoints
– this requires a binding that supports sessions
• Instancing
– Refers to controlling the lifetime of user-defined service objects and their related
InstanceContext objects
– Can be
• Per Call : a new service object is created for each client request
• Per Session : a new service object is created and maintained for each client session
• Single : a service object handles all client requests
• Concurency
– Term given to the control of the number of threads executing in an InstanceContext at the
same time
– Can be
• Single : Maximum of one thread processing messages in the instance context at a time
• Multiple : Can have multiple threads processing messages concurrently
• Reentrant : The service instance is single-threaded and accepts reentrant calls (Duplex)
• Continue reading here 23
WCF Concepts
Sessions, Instancing & Concurrency
• WCF is designed to solve the greater part of the
communication requirements, but there are
sometimes scenarios where the default behavior
is not valid.
• WCF is extensible by nature
– You can add or modify system behavior at every
level as you want
– Many shared concepts with AOP
• More than 25 interfaces to implement !
• Must-read blog post and here
24
WCF Extensibility
really powerfull !
25
WCF Extensibility
caching for service operations using IOperationInvoker
• Transaction
• Reliable Messaging
• WCF REST
• Queue Messaging
• Streaming & Large Data
• WCF Tracing
• Async
• Duplex Services
• Workflow Services
• Peer to Peer Networking
• Syndication
• WebSockets
• …
26
Others Features
To be continued …
What’s New in WCF 4 / 4.5 ?
27
• WS-Discovery Support
– Discovery Service
– Announcement feature
• Single WSDL Document
• New Https Binding
• WCF REST Improvements (deprecated)
• Task-based Async/Await Support
• New Configuration Default Values
– Concurrent Calls/sessions/Instances, Net.Tcp settings, Timeouts
• WebSocket Support
– 2 new bindings : NetHttpBinding and NetHttpsBinding
• WCF Configuration Tooltips & Validation on Build
28
What’s new in WCF 4 /4.5 ?
All you need is here and here
WCF 3.0
29
What’s new in WCF 4 /4.5 ?
Simplified Configuration
WCF 4.5
Thanks to standard bindings and protocols mappings !
• Define and activate WCF services without having to maintain physical .svc
30
What’s new in WCF 4 /4.5 ?
File-less Activation
• A generic SOAP intermediary that acts
as a message router
• Features
– Content-based routing
• Header
• Body
– Priority Routing
– Protocol bridging
• Ex : HT¨TP to NetTcp
– Multicast
– Backup & Failover endpoints
– …
• Continue here
31
What’s new in WCF 4 /4.5 ?
Routing Service
WCF Best Practices
32
• When invoking a service, a client should catch 3 types of exceptions
– TimeoutException
thrown when the time allotted for a process or operation has expired (on client or on server)
– CommunicationException
communication error in either the service or client application
– FaultException/FaultException<TDetail>
Represents a SOAP fault
• SOAP-based applications use fault messages to notify processing error
– “Exception” is not an unknown concept and not fully serializable
– Do not throw ArgumentException/ArgumentNullException/… use Faults !
• Exception details are not returned to client unless it has been activated
– Can be a security risk because details expose internal service implementation
– Use only on Dev
• For global Exception handling, there is an IErrorHandler extensibility point
• Continue reading here
33
WCF Best Practices
Exception Management & Fault Contracts
FaultContract is defined on each
operation
Service throws a Fault when there
is an handled/unhandled error
34
WCF Best Practices
FaultContracts sample
Client knows Faults (defined in
Contract) and can have specific
error management
• Always Close the client proxy
– Undisposed proxies can lead to memory leaks and random exceptions
• Close = Dispose in WCF
• Close/Dispose well
– Close can throw exceptions
• More info here
– http://stackoverflow.com/questions/573872/
– http://msdn.microsoft.com/en-us/library/aa355056.aspx
35
WCF Best Practices
Dispose well, Padawan !
• Running a test against a running WCF service is not unit testing, but
integration testing.
– Note : Testing WCF aspects is required because of all features (configuration,
serialization, behaviors & extensitibility…)
• To unit test your service, you should ignore the WCF aspect
– Instantiate and invoke the service class directly
– DI/IoC is possible in WCF using IInstanceProvider (see extensibility section, here
or here)
– Some workarounds when your service is using static class
OperationContext/WebOperationcontext (see here)
• The best way to have unit tests is to design your service for testing
– If your service code is all in the top-level class, then you wrote it to be untestable
– The service class should be logic-less and be only a wrapper for your code
36
WCF Best Practices
Unit Testing
• In SOA, services and clients are autonomous
– Service developers cannot assume that they control all clients
– should be able to evolve service independent of its clients.
• Four Categories of Service Changes
– Contract changes
an operation might be added, or a data element in a message might be added or changed
=> breaking / non-breaking
– Address changes
a service moves to a different location where endpoints have new addresses
=> breaking
– Binding changes
a security mechanism changes or its settings change
=> breaking
– Implementation changes
when an internal method implementation changes
Non breaking
• Continue reading here
37
WCF Best Practices
Service Changes
• Contracts used by a client and by the service don’t require to be the
same
– they need only to be compatible
• Versionning depends on the inner serializer (Datacontract,,
XmlSerializer, ..), serialization attributes (mandatory, optional,
order…) and schema validation (on/off)
– 2 main approachs
• Strict Versionning
Treat existing data contracts as immutable and create new ones with
unique qualified names.
• Lax Versionning
adding a new method, an optional member to the data contract will
not break existing clients.
Supported by WCF, but not by all clients
• Read the 15 tips here 38
WCF Best Practices
Contract Versionning
• Large set of performance counters to help you gauge your application's
performance
• Examples
– Service / Calls Per Second
– Service / Calls Faulted (Since restart)
– Operation / Call Duration
– EndPoint / Calls Failed Per Second
– …
• Activated by Config
• List of counters here
39
WCF Best Practices
Service Monitoring : Performance counters
40
WCF Best Practices
Performance counters integration in Centreon
• Auto Capture data generated by the execution of WCF Service
– Call Duration, Errors, Faults, Exceptions, …
– Data store implementation is a SQL Server database by default
• Use Event Tracing for Windows (ETW)
– Very limited impact on service
– Async by nature
• Monitoring Architecture
41
WCF Best Practices
AppFabric Monitoring
Monitoring Database
Dashboard
Custom
Tool
SQL Agent Job
WCF Events
Batch
Staging Table
WCF Events Table
DB Views
Server A
Runtime
WCF
EventCollector
Service
WCF
Server B
Runtime
WCF
EventCollector
Service
WCF
42
WCF Best Practices
AppFabric Monitoring
WCF Tools
43
• Simple GUI tool that enables users to test a service
• Can be standalone (without VS install)
– For SysAdmins for example
• Supported Features
– Service Invocation: Request/Response and One-way message.
– Bindings: all bindings supported by Svcutil.exe
– Controlling Session.
– Message Contract
– XML serialization
• Unsupported features
– Duplex, Transaction, Streaming, Security/Authentication, Some bindings, …
• Located at C:Program FilesMicrosoft Visual Studio 9.0Common7IDE
• More info at http://msdn.microsoft.com/en-us/library/bb552364.aspx
44
WCF Tools
WCFTestClient.exe
45
WCF Tools
WCFTestClient.exe
• A Soap Client for Http Service
• Made in Java
– Test exposed services outside MS envrionnement
– Invoke other Soap Service
• Features
– Project Support
– Follow Common WS-* Standard
– Test Suite / Mock Service
• Download free version at http://www.soapui.org/
46
WCF Tools
Soap UI
47
WCF Tools
Soap UI
• Simple GUI Config tool that Operates exclusively on
<system.serviceModel> section
• All WCF features in a GUI !
• Output is guaranteed to comply with the WCF schema
• Part of Windows SDK
– Located in C:Program Files (x86)Microsoft SDKsWindowsv8.0AbinNETFX
4.0 Tools
• Integrated in Visual Studio
– Tools/WCF Service Configuration Editor
– Right Click on a WCF Service Project
• More Info here
48
WCF Tools
SvcConfigEditor.exe
49
WCF Tools
SvcConfigEditor.exe
• Simple GUI tool that helps us analyze diagnostic traces that are generated
by WCF service (when activated)
• Part of Windows SDK
– Located in C:Program Files (x86)Microsoft SDKsWindowsv8.0AbinNETFX
4.0 Tools
• Traces Files associated with .svclog (part of Windows SDK)
• More Info here
50
WCF Tools
SvcTraceViewer.exe
51
WCF Tools
SvcTraceViewer.exe
• Used to generate service model code from metadata documents and
metadata documents from service model
– Example : Generate C# from an external Wsdl
• Features
– Generates code from running services or static metadata documents
– Exports metadata documents from compiled code
– Validates compiled service code
– Downloads metadata documents from running services
– Generates serialization code
• More info here
52
WCF Tools
Svcutil.exe
53
WCF Tools
Svcutil.exe
• Toolset that facilitates the development of web
services using a schema first approach
• Features
– VS extension (Menu, Toolbars, …)
– A WSDL Wizard that allows to step through the
creation of a WSDL from one or more XSDs
– Data Contract Generator
– A Service/Endpoint Stub (SVC) Generator
– A Client Proxy Generator
– A Generate Data Contract Code feature that supports
the selection of multiple XSD/WSDL source files
– …
• See project here
54
WSCF Blue
Use Cases
55
• To Prevent Denial of service (DoS) attacks, WCF have limits
– ReaderQuotas constraints on the complexity of SOAP messages that can be processed
“The maximum message size quota for incoming messages has been exceeded for the remote channel.
See the server logs for more details.”
– Throttling Throttling allows you to "smooth" out the load on the server
"The open operation did not complete within the allotted timeout of 00:00:59.9989999. The time allotted
to this operation may have been a portion of a longer timeout."
56
Common Errors
Reader Quotas & Throttling
• Enums should always have a default value (=0)
– Code Analysis recomanded Rule
– Serialization : Enums are int, and default is 0
57
Common Errors
Enums
• In WCF, there is no way to determine if service is up or down 
– Service down vs all calls are failed ?
– WCF vs IIS ?
– Client Timeouts/CommunicationExcetions vs Network failure ?
• However, some questions :
– Is IIS started ?
– Is the application pool started ?
– Are NetTcp/NamedPipe Services started ?
– Is WAS Started ?
– Is My service Activated ?
• A ping/heartbeat method is sometimes a solution …
58
Use Cases
Is my service Up ?
• « I always have a error (404 or unreachable url) when I go to
http://yourservicedomain/myservice.svc. My service doesn’t work. »
• Browsing svc file is not required to call the service
– Sometimes Metadata is not published or accessible (because of Firewall)
• It’s not because metadata is unreachable that you can’t invoke the service
– Use WCF Test Client / Soap UI / Unit Test to call a Reag/Get Method
59
Use Cases
404 and unreachable service
• Event logging is enabled automatically by default, and there is no
mechanism to disable it in WCF
• The Application Event Log contains most of the events generated by WCF.
Most of the entries indicate that a particular feature failed to start up for an
application. Examples include:
– Shared Listener: The WCF TCP Port Sharing Service logs an event when it fails
to start.
– Critical and error events, such as startup failures or crashes
– Message logging/tracing turned on/off: Logs events when message logging is
turned on/off. …
60
Use Cases
Service Startup
61
Use Cases
Event Logs
Questions?
62

Mais conteúdo relacionado

Mais procurados

HTTP request and response
HTTP request and responseHTTP request and response
HTTP request and responseSahil Agarwal
 
ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC Presentationivpol
 
Service-Oriented Architecture (SOA)
Service-Oriented Architecture (SOA)Service-Oriented Architecture (SOA)
Service-Oriented Architecture (SOA)WSO2
 
Design patterns for microservice architecture
Design patterns for microservice architectureDesign patterns for microservice architecture
Design patterns for microservice architectureThe Software House
 
Microservices
MicroservicesMicroservices
MicroservicesSmartBear
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework Serhat Can
 
Web Application Introduction
Web Application  IntroductionWeb Application  Introduction
Web Application Introductionshaojung
 
Understanding MicroSERVICE Architecture with Java & Spring Boot
Understanding MicroSERVICE Architecture with Java & Spring BootUnderstanding MicroSERVICE Architecture with Java & Spring Boot
Understanding MicroSERVICE Architecture with Java & Spring BootKashif Ali Siddiqui
 
Introduction to Spring's Dependency Injection
Introduction to Spring's Dependency InjectionIntroduction to Spring's Dependency Injection
Introduction to Spring's Dependency InjectionRichard Paul
 
Service discovery with Eureka and Spring Cloud
Service discovery with Eureka and Spring CloudService discovery with Eureka and Spring Cloud
Service discovery with Eureka and Spring CloudMarcelo Serpa
 
Soap web service
Soap web serviceSoap web service
Soap web serviceNITT, KAMK
 

Mais procurados (20)

HTTP request and response
HTTP request and responseHTTP request and response
HTTP request and response
 
ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC Presentation
 
Soap vs rest
Soap vs restSoap vs rest
Soap vs rest
 
Service-Oriented Architecture (SOA)
Service-Oriented Architecture (SOA)Service-Oriented Architecture (SOA)
Service-Oriented Architecture (SOA)
 
Design patterns for microservice architecture
Design patterns for microservice architectureDesign patterns for microservice architecture
Design patterns for microservice architecture
 
Web api
Web apiWeb api
Web api
 
Web services SOAP
Web services SOAPWeb services SOAP
Web services SOAP
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
 
Express js
Express jsExpress js
Express js
 
Microservices
MicroservicesMicroservices
Microservices
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
 
Web Application Introduction
Web Application  IntroductionWeb Application  Introduction
Web Application Introduction
 
Understanding MicroSERVICE Architecture with Java & Spring Boot
Understanding MicroSERVICE Architecture with Java & Spring BootUnderstanding MicroSERVICE Architecture with Java & Spring Boot
Understanding MicroSERVICE Architecture with Java & Spring Boot
 
Introduction to Spring's Dependency Injection
Introduction to Spring's Dependency InjectionIntroduction to Spring's Dependency Injection
Introduction to Spring's Dependency Injection
 
Service discovery with Eureka and Spring Cloud
Service discovery with Eureka and Spring CloudService discovery with Eureka and Spring Cloud
Service discovery with Eureka and Spring Cloud
 
Soap web service
Soap web serviceSoap web service
Soap web service
 
Mvc architecture
Mvc architectureMvc architecture
Mvc architecture
 
Introduction to spring boot
Introduction to spring bootIntroduction to spring boot
Introduction to spring boot
 
Software Design Patterns
Software Design PatternsSoftware Design Patterns
Software Design Patterns
 
Introduction to Microservices
Introduction to MicroservicesIntroduction to Microservices
Introduction to Microservices
 

Destaque

Web API or WCF - An Architectural Comparison
Web API or WCF - An Architectural ComparisonWeb API or WCF - An Architectural Comparison
Web API or WCF - An Architectural ComparisonAdnan Masood
 
WCF (Windows Communication Foundation)
WCF (Windows Communication Foundation)WCF (Windows Communication Foundation)
WCF (Windows Communication Foundation)ipower softwares
 
Advanced WCF Workshop
Advanced WCF WorkshopAdvanced WCF Workshop
Advanced WCF WorkshopIdo Flatow
 
ASP.NET Mvc 4 web api
ASP.NET Mvc 4 web apiASP.NET Mvc 4 web api
ASP.NET Mvc 4 web apiTiago Knoch
 
There is time for rest
There is time for rest There is time for rest
There is time for rest SoftServe
 
WCF Security, FSec
WCF Security, FSecWCF Security, FSec
WCF Security, FSecAnte Gulam
 
Overview of Rest Service and ASP.NET WEB API
Overview of Rest Service and ASP.NET WEB APIOverview of Rest Service and ASP.NET WEB API
Overview of Rest Service and ASP.NET WEB APIPankaj Bajaj
 
C# ASP.NET WEB API APPLICATION DEVELOPMENT
C# ASP.NET WEB API APPLICATION DEVELOPMENTC# ASP.NET WEB API APPLICATION DEVELOPMENT
C# ASP.NET WEB API APPLICATION DEVELOPMENTDr. Awase Khirni Syed
 
Lunch Learn - WCF Security
Lunch Learn - WCF SecurityLunch Learn - WCF Security
Lunch Learn - WCF SecurityPaul Senatillaka
 
Architecture of .net framework
Architecture of .net frameworkArchitecture of .net framework
Architecture of .net frameworkThen Murugeshwari
 
Data Warehousing and Data Mining
Data Warehousing and Data MiningData Warehousing and Data Mining
Data Warehousing and Data Miningidnats
 
Mysql gdb-101022041146-phpapp01
Mysql gdb-101022041146-phpapp01Mysql gdb-101022041146-phpapp01
Mysql gdb-101022041146-phpapp01Bob Huang
 
Wcf security session 2
Wcf security session 2Wcf security session 2
Wcf security session 2Anil Kumar M
 
WCF security
WCF securityWCF security
WCF securityexatex
 

Destaque (20)

Web API or WCF - An Architectural Comparison
Web API or WCF - An Architectural ComparisonWeb API or WCF - An Architectural Comparison
Web API or WCF - An Architectural Comparison
 
Wcf development
Wcf developmentWcf development
Wcf development
 
WCF (Windows Communication Foundation)
WCF (Windows Communication Foundation)WCF (Windows Communication Foundation)
WCF (Windows Communication Foundation)
 
Windows Communication Foundation (WCF) Best Practices
Windows Communication Foundation (WCF) Best PracticesWindows Communication Foundation (WCF) Best Practices
Windows Communication Foundation (WCF) Best Practices
 
Advanced WCF Workshop
Advanced WCF WorkshopAdvanced WCF Workshop
Advanced WCF Workshop
 
ASP.NET Mvc 4 web api
ASP.NET Mvc 4 web apiASP.NET Mvc 4 web api
ASP.NET Mvc 4 web api
 
Wcf
WcfWcf
Wcf
 
There is time for rest
There is time for rest There is time for rest
There is time for rest
 
WCF 4.0
WCF 4.0WCF 4.0
WCF 4.0
 
WCF Security, FSec
WCF Security, FSecWCF Security, FSec
WCF Security, FSec
 
Overview of Rest Service and ASP.NET WEB API
Overview of Rest Service and ASP.NET WEB APIOverview of Rest Service and ASP.NET WEB API
Overview of Rest Service and ASP.NET WEB API
 
C# ASP.NET WEB API APPLICATION DEVELOPMENT
C# ASP.NET WEB API APPLICATION DEVELOPMENTC# ASP.NET WEB API APPLICATION DEVELOPMENT
C# ASP.NET WEB API APPLICATION DEVELOPMENT
 
Lunch Learn - WCF Security
Lunch Learn - WCF SecurityLunch Learn - WCF Security
Lunch Learn - WCF Security
 
Architecture of .net framework
Architecture of .net frameworkArchitecture of .net framework
Architecture of .net framework
 
DATA WAREHOUSING AND DATA MINING
DATA WAREHOUSING AND DATA MININGDATA WAREHOUSING AND DATA MINING
DATA WAREHOUSING AND DATA MINING
 
Data mining
Data miningData mining
Data mining
 
Data Warehousing and Data Mining
Data Warehousing and Data MiningData Warehousing and Data Mining
Data Warehousing and Data Mining
 
Mysql gdb-101022041146-phpapp01
Mysql gdb-101022041146-phpapp01Mysql gdb-101022041146-phpapp01
Mysql gdb-101022041146-phpapp01
 
Wcf security session 2
Wcf security session 2Wcf security session 2
Wcf security session 2
 
WCF security
WCF securityWCF security
WCF security
 

Semelhante a Windows Communication Foundation (WCF)

Complete Architecture and Development Guide To Windows Communication Foundati...
Complete Architecture and Development Guide To Windows Communication Foundati...Complete Architecture and Development Guide To Windows Communication Foundati...
Complete Architecture and Development Guide To Windows Communication Foundati...Abdul Khan
 
D1-3-Signaling
D1-3-SignalingD1-3-Signaling
D1-3-SignalingOleg Levy
 
1. WCF Services - Exam 70-487
1. WCF Services - Exam 70-4871. WCF Services - Exam 70-487
1. WCF Services - Exam 70-487Bat Programmer
 
web services-May 25.ppt
web services-May 25.pptweb services-May 25.ppt
web services-May 25.pptShivaangiKrish
 
Advancio, Inc. Academy: Web Sevices, WCF & SOAPUI
Advancio, Inc. Academy: Web Sevices, WCF & SOAPUIAdvancio, Inc. Academy: Web Sevices, WCF & SOAPUI
Advancio, Inc. Academy: Web Sevices, WCF & SOAPUIAdvancio
 
Developing and Hosting SOAP Based Services
Developing and Hosting SOAP Based ServicesDeveloping and Hosting SOAP Based Services
Developing and Hosting SOAP Based ServicesStephenKardian
 
Session 1 Shanon Richards-Exposing Data Using WCF
Session 1 Shanon Richards-Exposing Data Using WCFSession 1 Shanon Richards-Exposing Data Using WCF
Session 1 Shanon Richards-Exposing Data Using WCFCode Mastery
 
Windows communication foundation ii
Windows communication foundation iiWindows communication foundation ii
Windows communication foundation iiSwamy Gowtham
 
complete web service1.ppt
complete web service1.pptcomplete web service1.ppt
complete web service1.pptDr.Saranya K.G
 
A presentation on WCF & REST
A presentation on WCF & RESTA presentation on WCF & REST
A presentation on WCF & RESTSanthu Rao
 
Dot Net Training Wcf Dot Net35
Dot Net Training Wcf Dot Net35Dot Net Training Wcf Dot Net35
Dot Net Training Wcf Dot Net35Subodh Pushpak
 
Exploring Twitter's Finagle technology stack for microservices
Exploring Twitter's Finagle technology stack for microservicesExploring Twitter's Finagle technology stack for microservices
Exploring Twitter's Finagle technology stack for microservices💡 Tomasz Kogut
 
HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...
HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...
HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...Edward Burns
 
Managing Microservices With The Istio Service Mesh on Kubernetes
Managing Microservices With The Istio Service Mesh on KubernetesManaging Microservices With The Istio Service Mesh on Kubernetes
Managing Microservices With The Istio Service Mesh on KubernetesIftach Schonbaum
 

Semelhante a Windows Communication Foundation (WCF) (20)

Complete Architecture and Development Guide To Windows Communication Foundati...
Complete Architecture and Development Guide To Windows Communication Foundati...Complete Architecture and Development Guide To Windows Communication Foundati...
Complete Architecture and Development Guide To Windows Communication Foundati...
 
Windows Communication Foundation
Windows Communication FoundationWindows Communication Foundation
Windows Communication Foundation
 
web programming
web programmingweb programming
web programming
 
D1-3-Signaling
D1-3-SignalingD1-3-Signaling
D1-3-Signaling
 
Windows 8 Metro apps and the outside world
Windows 8 Metro apps and the outside worldWindows 8 Metro apps and the outside world
Windows 8 Metro apps and the outside world
 
1. WCF Services - Exam 70-487
1. WCF Services - Exam 70-4871. WCF Services - Exam 70-487
1. WCF Services - Exam 70-487
 
WCF
WCFWCF
WCF
 
web services-May 25.ppt
web services-May 25.pptweb services-May 25.ppt
web services-May 25.ppt
 
Advancio, Inc. Academy: Web Sevices, WCF & SOAPUI
Advancio, Inc. Academy: Web Sevices, WCF & SOAPUIAdvancio, Inc. Academy: Web Sevices, WCF & SOAPUI
Advancio, Inc. Academy: Web Sevices, WCF & SOAPUI
 
Developing and Hosting SOAP Based Services
Developing and Hosting SOAP Based ServicesDeveloping and Hosting SOAP Based Services
Developing and Hosting SOAP Based Services
 
Session 1 Shanon Richards-Exposing Data Using WCF
Session 1 Shanon Richards-Exposing Data Using WCFSession 1 Shanon Richards-Exposing Data Using WCF
Session 1 Shanon Richards-Exposing Data Using WCF
 
Windows communication foundation ii
Windows communication foundation iiWindows communication foundation ii
Windows communication foundation ii
 
complete web service1.ppt
complete web service1.pptcomplete web service1.ppt
complete web service1.ppt
 
A presentation on WCF & REST
A presentation on WCF & RESTA presentation on WCF & REST
A presentation on WCF & REST
 
Wcf v1-day1
Wcf v1-day1Wcf v1-day1
Wcf v1-day1
 
Dot Net Training Wcf Dot Net35
Dot Net Training Wcf Dot Net35Dot Net Training Wcf Dot Net35
Dot Net Training Wcf Dot Net35
 
Wcf Overview
Wcf OverviewWcf Overview
Wcf Overview
 
Exploring Twitter's Finagle technology stack for microservices
Exploring Twitter's Finagle technology stack for microservicesExploring Twitter's Finagle technology stack for microservices
Exploring Twitter's Finagle technology stack for microservices
 
HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...
HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...
HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...
 
Managing Microservices With The Istio Service Mesh on Kubernetes
Managing Microservices With The Istio Service Mesh on KubernetesManaging Microservices With The Istio Service Mesh on Kubernetes
Managing Microservices With The Istio Service Mesh on Kubernetes
 

Mais de Betclic Everest Group Tech Team

Mini-training: Personalization & Recommendation Demystified
Mini-training: Personalization & Recommendation DemystifiedMini-training: Personalization & Recommendation Demystified
Mini-training: Personalization & Recommendation DemystifiedBetclic Everest Group Tech Team
 

Mais de Betclic Everest Group Tech Team (20)

Mini training - Reactive Extensions (Rx)
Mini training - Reactive Extensions (Rx)Mini training - Reactive Extensions (Rx)
Mini training - Reactive Extensions (Rx)
 
Mini training - Moving to xUnit.net
Mini training - Moving to xUnit.netMini training - Moving to xUnit.net
Mini training - Moving to xUnit.net
 
Mini training - Introduction to Microsoft Azure Storage
Mini training - Introduction to Microsoft Azure StorageMini training - Introduction to Microsoft Azure Storage
Mini training - Introduction to Microsoft Azure Storage
 
Akka.Net
Akka.NetAkka.Net
Akka.Net
 
Mini training- Scenario Driven Design
Mini training- Scenario Driven DesignMini training- Scenario Driven Design
Mini training- Scenario Driven Design
 
Email Management in Outlook
Email Management in OutlookEmail Management in Outlook
Email Management in Outlook
 
Mini-Training: SSO with Windows Identity Foundation
Mini-Training: SSO with Windows Identity FoundationMini-Training: SSO with Windows Identity Foundation
Mini-Training: SSO with Windows Identity Foundation
 
Training - What is Performance ?
Training  - What is Performance ?Training  - What is Performance ?
Training - What is Performance ?
 
Mini-Training: Docker
Mini-Training: DockerMini-Training: Docker
Mini-Training: Docker
 
Mini Training Flyway
Mini Training FlywayMini Training Flyway
Mini Training Flyway
 
Mini-Training: NDepend
Mini-Training: NDependMini-Training: NDepend
Mini-Training: NDepend
 
Management 3.0 Workout
Management 3.0 WorkoutManagement 3.0 Workout
Management 3.0 Workout
 
Lean for Business
Lean for BusinessLean for Business
Lean for Business
 
Short-Training asp.net vNext
Short-Training asp.net vNextShort-Training asp.net vNext
Short-Training asp.net vNext
 
Training – Going Async
Training – Going AsyncTraining – Going Async
Training – Going Async
 
Mini-Training: Mobile UX Trends
Mini-Training: Mobile UX TrendsMini-Training: Mobile UX Trends
Mini-Training: Mobile UX Trends
 
Training: MVVM Pattern
Training: MVVM PatternTraining: MVVM Pattern
Training: MVVM Pattern
 
Mini-training: Personalization & Recommendation Demystified
Mini-training: Personalization & Recommendation DemystifiedMini-training: Personalization & Recommendation Demystified
Mini-training: Personalization & Recommendation Demystified
 
Mini-training: Let’s Git It!
Mini-training: Let’s Git It!Mini-training: Let’s Git It!
Mini-training: Let’s Git It!
 
AngularJS Best Practices
AngularJS Best PracticesAngularJS Best Practices
AngularJS Best Practices
 

Último

UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfDianaGray10
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IES VE
 
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?IES VE
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfinfogdgmi
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Adtran
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UbiTrack UK
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxMatsuo Lab
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxUdaiappa Ramachandran
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemAsko Soukka
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureEric D. Schabell
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7DianaGray10
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URLRuncy Oommen
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.YounusS2
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...DianaGray10
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...Aggregage
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAshyamraj55
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationIES VE
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-pyJamie (Taka) Wang
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6DianaGray10
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintMahmoud Rabie
 

Último (20)

UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
 
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdf
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptx
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptx
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystem
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability Adventure
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URL
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-py
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership Blueprint
 

Windows Communication Foundation (WCF)

  • 2. • Introduction • Basic Concepts • Going deeper • What's New in WCF 4/4.5 • Best Practices • WCF Tools • Use Cases 2 Agenda yes, we can !
  • 3. • I won’t explain you every concepts & components of WCF  • I will try to educate you to common WCF features and give you some best practices • I have included as many links as possible 3 Introduction Objectives
  • 4. • WCF (CodeName Indigo) is a unified communication framework in.NET for building connected, service-oriented applications • Introduced in .Net 3.0 – Before WCF : ASMX, Remoting, TcpServer, COM, POX… • Defines a common programming model and unified API for clients and services to send messages between each other • Key characteristics – Service-oriented programming model (SOA): • Services are offered on an endpoint. • WCF completely separates service hosting, endpoints and services – Interoperability with non-WCF web services due to use of SOAP messages • WCF implements many of the WS-* standards – Extensibility • WCF client / server can be configured to interoperate with REST, ATOM- feeds, plain XML or JSON messages 4 Introduction Why WCF ?
  • 5. • To expose our first WCF service, we need – An Endpoint (WCF’s ABC) – A Service Implementation – Some Config – An Hosting Environnment 5 How to build our first WCF Service (a very basic service )
  • 6. • Address : « Where is my service ? » – The location of the service on the network where it can be reached • Some examples – http://localhost/calculatorservice.svc – net.msmq://localhost/private/calculatorservice – net.tcp://localhost:6000/calculatorservice • Set via configuration/code or inherited from Hosting Environment 6 ABC’s of WCF Give me the A !
  • 7. • Binding : « How do I talk to this thing? » – The protocol/policies/settings used to connect to the service at it’s address • Some examples – Http(BasicHttp, WsHttp, WsDualHttp, WsFederation) – NetMsmq – NetNamedPipe – NetTcp – CustomBinding – … • Contains – Transport protocol (HTTP, TCP, MSMQ, …) – Message encoding (MTOM, XML, JSON, Binary, …) – Security / reliability settings (encryption & authentication) – … • All system provided binding are available here 7 ABC’s of WCF Give me the B !
  • 8. • A Binding is an aggregate of micro WCF features – Security, Duplex, Session, Encoding, Streaming, … 8 ABC’s of WCF Give me the B !
  • 9. • Contract : « What’s it going to do for me? » – Defines the operations, inputs, outputs, and mep of the service. • In WCF, a Contract is defined by an interface • A Contract defines – Grouping of operations in a service => .Net attribute [ServiceContract] – Signature of operations => .Net attribute [OperationContract] – Data types of operations => .Net attribute [DataContract] 9 ABC’s of WCF Give me the C !
  • 10. 10 Our first WCF Service on the road to Carl …
  • 11. • Services are designed to run in any Windows process that supports managed code – Hosting Options • Self-Hosting Fast & Flexible but not an enterprise solution • Windows Service Secure, Supported by all windows but lack of reliable features • IIS/WAS Components required but all advantages of IIS • IIS7 (Vista/WS2K8) introduced Windows Activation Service (WAS) – Host non HTTP protocols in IIS like Net.Tcp, NamedPipe, MSMQ… • Continue reading here 11 WCF Hosting How & where do I host my new WCF service ?
  • 13. • A WCF client is used to invoke a WCF Service – It’s not mandatory but will help you a lot (create SOAP manually ?) – Translate .Net code to SOAP and vice-versa – Logic-less implementation of Proxy Design Pattern • To create a WCF client, you need – An Address – A Binding – A Contract – Some code – (extra configuration & settings) • Clients have to be stateless and disposed when required 13 How to call this Service ? WCF Clients
  • 14. • An Automatic WCF Client in 2 clics • Generate all client code, contract & configuration. • Best suite if you don’t know the contract 14 WCF Clients example #1 : Service Reference
  • 15. • A little more code • Perfect if you already know the contract 15 WCF Clients example #2 : ChannelFactory<T>
  • 16. • WCF allows use to expose Metadata using standardized protocols – Metadata ? • Operations a client perform • The structure of the data types that the operations work with or return • Definitions of all the endpoints implemented by the service and the various options needed for each such as security => Basically, how to call the service • Two ways to expose Metadata – Mex Endpoint (for all services/bindings) – Wsdl/Disco (only for http Services) • Metadata is generally not exposed for production public service • More info here 16 WCF Metadata what is it ?
  • 17. Http(s)GetEnabled 17 WCF Metadata how to publish metadata IMexdataExchange
  • 18. • WCF Supports 3 MEPs – OneWay Client sends a message using a fire and forget exchange. Like UDP, it does not guarantee that the remote endpoint has received the message . Defined at operation level. Warning : it’s not async ! – Request-Reply (Default) Client sends a message to a WCF Service and then waits for a reply (no response = TimeOutException). Client stops processing until the return message is received. Classic pairs of Request-Response like in HTTP GET method. – Duplex Like a phone conversation, both sides can send and receive messages. Defined at contract level. • Continue reading here 18 WCF Messaging Message Exchange Patterns (MEP)
  • 19. • In Connected Systems, there is no magic translation and data needs to be exchanged in a serialized form • WCF provides 2 Serializer – DataContractSerializer Opt-in Serialization • DataContract or Message Contract – XmlSerializer Opt-out Serialization => 2 Serializers to handle all scenarios • There are also many ways to by-pass serialization – Using Stream object (for Streaming and Large Data) – Using Message class (Parsing Soap Message directly) • More info here 19 WCF Serialization hidden part
  • 21. • Scope of WCF Security – Transfer security Responsible for providing message confidentiality, data integrity, and authentication of communicating parties – Authorization Responsible for providing a framework for making authorization decisions – Auditing Responsible for logging security-related events to the audit log • Basically WCF Security is managed by Security Configuration – None – Transport – Message – Both – TransportWithMessageCredential or TransportCredentialOnly • All bindings don’t provide the same security features ! • Continue reading here and here 21 WCF Security do not fear …
  • 22. Transport Security User credentials and claims are passed using the transport layer  Interoperabable  Performant & Hardware Accelerated o Transport-dependant o Limited set of credentials o Point to Point com only 22 WCF Security Message Vs Transport Security Message Security User credentials and claims are encapsulated in every message using the WS-Security specification  end-to-end security  Partial/selective encryption and signing  Transport-independent o Limited interoperability (WS-Security) o Less performant
  • 23. • Sessions – A session is a correlation of all messages sent between two endpoints – this requires a binding that supports sessions • Instancing – Refers to controlling the lifetime of user-defined service objects and their related InstanceContext objects – Can be • Per Call : a new service object is created for each client request • Per Session : a new service object is created and maintained for each client session • Single : a service object handles all client requests • Concurency – Term given to the control of the number of threads executing in an InstanceContext at the same time – Can be • Single : Maximum of one thread processing messages in the instance context at a time • Multiple : Can have multiple threads processing messages concurrently • Reentrant : The service instance is single-threaded and accepts reentrant calls (Duplex) • Continue reading here 23 WCF Concepts Sessions, Instancing & Concurrency
  • 24. • WCF is designed to solve the greater part of the communication requirements, but there are sometimes scenarios where the default behavior is not valid. • WCF is extensible by nature – You can add or modify system behavior at every level as you want – Many shared concepts with AOP • More than 25 interfaces to implement ! • Must-read blog post and here 24 WCF Extensibility really powerfull !
  • 25. 25 WCF Extensibility caching for service operations using IOperationInvoker
  • 26. • Transaction • Reliable Messaging • WCF REST • Queue Messaging • Streaming & Large Data • WCF Tracing • Async • Duplex Services • Workflow Services • Peer to Peer Networking • Syndication • WebSockets • … 26 Others Features To be continued …
  • 27. What’s New in WCF 4 / 4.5 ? 27
  • 28. • WS-Discovery Support – Discovery Service – Announcement feature • Single WSDL Document • New Https Binding • WCF REST Improvements (deprecated) • Task-based Async/Await Support • New Configuration Default Values – Concurrent Calls/sessions/Instances, Net.Tcp settings, Timeouts • WebSocket Support – 2 new bindings : NetHttpBinding and NetHttpsBinding • WCF Configuration Tooltips & Validation on Build 28 What’s new in WCF 4 /4.5 ? All you need is here and here
  • 29. WCF 3.0 29 What’s new in WCF 4 /4.5 ? Simplified Configuration WCF 4.5 Thanks to standard bindings and protocols mappings !
  • 30. • Define and activate WCF services without having to maintain physical .svc 30 What’s new in WCF 4 /4.5 ? File-less Activation
  • 31. • A generic SOAP intermediary that acts as a message router • Features – Content-based routing • Header • Body – Priority Routing – Protocol bridging • Ex : HT¨TP to NetTcp – Multicast – Backup & Failover endpoints – … • Continue here 31 What’s new in WCF 4 /4.5 ? Routing Service
  • 33. • When invoking a service, a client should catch 3 types of exceptions – TimeoutException thrown when the time allotted for a process or operation has expired (on client or on server) – CommunicationException communication error in either the service or client application – FaultException/FaultException<TDetail> Represents a SOAP fault • SOAP-based applications use fault messages to notify processing error – “Exception” is not an unknown concept and not fully serializable – Do not throw ArgumentException/ArgumentNullException/… use Faults ! • Exception details are not returned to client unless it has been activated – Can be a security risk because details expose internal service implementation – Use only on Dev • For global Exception handling, there is an IErrorHandler extensibility point • Continue reading here 33 WCF Best Practices Exception Management & Fault Contracts
  • 34. FaultContract is defined on each operation Service throws a Fault when there is an handled/unhandled error 34 WCF Best Practices FaultContracts sample Client knows Faults (defined in Contract) and can have specific error management
  • 35. • Always Close the client proxy – Undisposed proxies can lead to memory leaks and random exceptions • Close = Dispose in WCF • Close/Dispose well – Close can throw exceptions • More info here – http://stackoverflow.com/questions/573872/ – http://msdn.microsoft.com/en-us/library/aa355056.aspx 35 WCF Best Practices Dispose well, Padawan !
  • 36. • Running a test against a running WCF service is not unit testing, but integration testing. – Note : Testing WCF aspects is required because of all features (configuration, serialization, behaviors & extensitibility…) • To unit test your service, you should ignore the WCF aspect – Instantiate and invoke the service class directly – DI/IoC is possible in WCF using IInstanceProvider (see extensibility section, here or here) – Some workarounds when your service is using static class OperationContext/WebOperationcontext (see here) • The best way to have unit tests is to design your service for testing – If your service code is all in the top-level class, then you wrote it to be untestable – The service class should be logic-less and be only a wrapper for your code 36 WCF Best Practices Unit Testing
  • 37. • In SOA, services and clients are autonomous – Service developers cannot assume that they control all clients – should be able to evolve service independent of its clients. • Four Categories of Service Changes – Contract changes an operation might be added, or a data element in a message might be added or changed => breaking / non-breaking – Address changes a service moves to a different location where endpoints have new addresses => breaking – Binding changes a security mechanism changes or its settings change => breaking – Implementation changes when an internal method implementation changes Non breaking • Continue reading here 37 WCF Best Practices Service Changes
  • 38. • Contracts used by a client and by the service don’t require to be the same – they need only to be compatible • Versionning depends on the inner serializer (Datacontract,, XmlSerializer, ..), serialization attributes (mandatory, optional, order…) and schema validation (on/off) – 2 main approachs • Strict Versionning Treat existing data contracts as immutable and create new ones with unique qualified names. • Lax Versionning adding a new method, an optional member to the data contract will not break existing clients. Supported by WCF, but not by all clients • Read the 15 tips here 38 WCF Best Practices Contract Versionning
  • 39. • Large set of performance counters to help you gauge your application's performance • Examples – Service / Calls Per Second – Service / Calls Faulted (Since restart) – Operation / Call Duration – EndPoint / Calls Failed Per Second – … • Activated by Config • List of counters here 39 WCF Best Practices Service Monitoring : Performance counters
  • 40. 40 WCF Best Practices Performance counters integration in Centreon
  • 41. • Auto Capture data generated by the execution of WCF Service – Call Duration, Errors, Faults, Exceptions, … – Data store implementation is a SQL Server database by default • Use Event Tracing for Windows (ETW) – Very limited impact on service – Async by nature • Monitoring Architecture 41 WCF Best Practices AppFabric Monitoring Monitoring Database Dashboard Custom Tool SQL Agent Job WCF Events Batch Staging Table WCF Events Table DB Views Server A Runtime WCF EventCollector Service WCF Server B Runtime WCF EventCollector Service WCF
  • 44. • Simple GUI tool that enables users to test a service • Can be standalone (without VS install) – For SysAdmins for example • Supported Features – Service Invocation: Request/Response and One-way message. – Bindings: all bindings supported by Svcutil.exe – Controlling Session. – Message Contract – XML serialization • Unsupported features – Duplex, Transaction, Streaming, Security/Authentication, Some bindings, … • Located at C:Program FilesMicrosoft Visual Studio 9.0Common7IDE • More info at http://msdn.microsoft.com/en-us/library/bb552364.aspx 44 WCF Tools WCFTestClient.exe
  • 46. • A Soap Client for Http Service • Made in Java – Test exposed services outside MS envrionnement – Invoke other Soap Service • Features – Project Support – Follow Common WS-* Standard – Test Suite / Mock Service • Download free version at http://www.soapui.org/ 46 WCF Tools Soap UI
  • 48. • Simple GUI Config tool that Operates exclusively on <system.serviceModel> section • All WCF features in a GUI ! • Output is guaranteed to comply with the WCF schema • Part of Windows SDK – Located in C:Program Files (x86)Microsoft SDKsWindowsv8.0AbinNETFX 4.0 Tools • Integrated in Visual Studio – Tools/WCF Service Configuration Editor – Right Click on a WCF Service Project • More Info here 48 WCF Tools SvcConfigEditor.exe
  • 50. • Simple GUI tool that helps us analyze diagnostic traces that are generated by WCF service (when activated) • Part of Windows SDK – Located in C:Program Files (x86)Microsoft SDKsWindowsv8.0AbinNETFX 4.0 Tools • Traces Files associated with .svclog (part of Windows SDK) • More Info here 50 WCF Tools SvcTraceViewer.exe
  • 52. • Used to generate service model code from metadata documents and metadata documents from service model – Example : Generate C# from an external Wsdl • Features – Generates code from running services or static metadata documents – Exports metadata documents from compiled code – Validates compiled service code – Downloads metadata documents from running services – Generates serialization code • More info here 52 WCF Tools Svcutil.exe
  • 54. • Toolset that facilitates the development of web services using a schema first approach • Features – VS extension (Menu, Toolbars, …) – A WSDL Wizard that allows to step through the creation of a WSDL from one or more XSDs – Data Contract Generator – A Service/Endpoint Stub (SVC) Generator – A Client Proxy Generator – A Generate Data Contract Code feature that supports the selection of multiple XSD/WSDL source files – … • See project here 54 WSCF Blue
  • 56. • To Prevent Denial of service (DoS) attacks, WCF have limits – ReaderQuotas constraints on the complexity of SOAP messages that can be processed “The maximum message size quota for incoming messages has been exceeded for the remote channel. See the server logs for more details.” – Throttling Throttling allows you to "smooth" out the load on the server "The open operation did not complete within the allotted timeout of 00:00:59.9989999. The time allotted to this operation may have been a portion of a longer timeout." 56 Common Errors Reader Quotas & Throttling
  • 57. • Enums should always have a default value (=0) – Code Analysis recomanded Rule – Serialization : Enums are int, and default is 0 57 Common Errors Enums
  • 58. • In WCF, there is no way to determine if service is up or down  – Service down vs all calls are failed ? – WCF vs IIS ? – Client Timeouts/CommunicationExcetions vs Network failure ? • However, some questions : – Is IIS started ? – Is the application pool started ? – Are NetTcp/NamedPipe Services started ? – Is WAS Started ? – Is My service Activated ? • A ping/heartbeat method is sometimes a solution … 58 Use Cases Is my service Up ?
  • 59. • « I always have a error (404 or unreachable url) when I go to http://yourservicedomain/myservice.svc. My service doesn’t work. » • Browsing svc file is not required to call the service – Sometimes Metadata is not published or accessible (because of Firewall) • It’s not because metadata is unreachable that you can’t invoke the service – Use WCF Test Client / Soap UI / Unit Test to call a Reag/Get Method 59 Use Cases 404 and unreachable service
  • 60. • Event logging is enabled automatically by default, and there is no mechanism to disable it in WCF • The Application Event Log contains most of the events generated by WCF. Most of the entries indicate that a particular feature failed to start up for an application. Examples include: – Shared Listener: The WCF TCP Port Sharing Service logs an event when it fails to start. – Critical and error events, such as startup failures or crashes – Message logging/tracing turned on/off: Logs events when message logging is turned on/off. … 60 Use Cases Service Startup