Windows Communication Foundation (WCF) is Microsoft’s new framework for building distributed systems. It unifies and builds on the diverse set of existing distribution mechanisms, which include ASP.NET Web services and .NET remoting. WCF enables developers to produce highly configurable, secure, reliable and transactional services using a single simplified programming model. And since WCF supports the WS-* series of Web service standards, it enables simple interoperation with other platforms and technologies. This 3 day course provides a thorough grounding in this important technology. The first chapter covers the essential concepts and shows how to implement WCF services and clients. The “ABC” of address, binding and contracts are covered in detail. Service contracts and data contracts are elaborated, and instance management is covered. The course includes a discussion of error handling and security and concludes with coverage of the WCF Routing Service. A large number of working examples and lab exercises are provided. The course uses .NET 4.5 and Visual Studio 2012.
Objectives
Learn what WCF is, and how it unites existing distribution mechanisms.
Gain an understanding of addressing and binding in WCF services.
Use service contracts and data contracts.
Implement WCF services and clients.
Perform configuration in both code and configuration files.
Understand faults and handle errors in WCF applications.
Implement security in WCF applications.
Understand the WCF Routing Service.
Detailed Outline
- WCF Essentials
- What is WCF?
- WCF Services
- Service Orientation
- WCF = ABC
- Address, Binding, Contract
- Hosting Services
- A Service Contract
- Visual Studio WCF Test Host
- Closing the Test Host Manually
- Self-Hosting
- ServiceHost Class
- Host Life Cycle
- WCF Clients
- Channels
- Channel Factory
- Base Address
- Uri Class
- Configuration Files
- Simplified Host Code
- Proxy Initialization
- Metadata Exchange
- Behaviors
- A Service in a Browser
- Standard Endpoints
- WCF Architecture
- ServiceHost and Channel Factory
- Service Contexts and Instances
- Addresses and Bindings
- Addresses
- Transports
- Bindings
- Message Exchange Patterns
- Security
- Choosing a Binding
- HTTP Bindings
- TCP and Named Pipe Bindings
- MSMQ Bindings
- Importance of BasicHttpBinding
- Working with Endpoints
- Default Endpoints & Bindings
- Helper Methods
- ServiceDescription Class
- Multiple Endpoints Configuration File
- Simple Host Code
- Service Contracts
- Service Contracts at Class Level
- Service Contracts at Interface Level
- Benefits of Interface Level Definition
- A Service with Multiple Contracts
- ServiceContractAttribute
- Attributes in WSDL
- Viewing WSDL Files
- Contract Inheritance
- Operation Overloading
- Enabling Operation Overloading
- Operation Overloading Client
- Instance Management
- Behaviors
- WCF Behaviors
- Configuring Behaviors in Code
- WCF Instancing Models
- Per-Call Instancing
- Per-Session Instancing
- Sessions and Threading
- Singleton Instancing
- Which Model to Use?
- Windows Forms WCF Clients
- Data Contracts
- Data Contracts
- XSD for Data Contract
- Arrays
- Array in XML Schema
- Array in Proxy
- Generic Collections
- Generic Collections in XML Schema
- Generic Collections in Proxy
- Enumerations in Data Contracts
- Employee Client Program
- Saving and Restoring
- Serialization in WCF and .NET
- SOAP Serialization
- DataContract Serialization
- JSON Serialization
- Using XmlSerializer
- Restoring Data
- Versioning
- New and Missing Members
- New Client of Old Service
- Round Trip
- Required Members
- OnDeserializing Event
- More about Service Contracts
- Versioning Service Contracts
- Version 1 Service
- Version 2 Service
- New Operations
- Version 3 Service
- Version 1 Client/Version 3 Service
- Version 2 Client/Version 2 Service
- Version 3 Client/Version 3 Service
- Message Exchange Patterns
- Request-Reply
- Oneway / Duplex
- Callbacks
- Invoking a Callback
- Callback on a Client
- Threading Considerations
- Task-Based Asynchronous Patterns
- Task-Based Client
- WebSockets
- Handling Errors
- Errors in Distributed Systems
- Errors in .NET and WCF
- Service Library Code
- Client Code
- Client Exception Handling
- Fault Exceptions
- Exception Details in Faults
- Exception Details
- Exception Dialog
- Fault Contracts
- Custom Faults
- Faulted Channels
- WCF Security
- Services and Security
- Security Aspects of Services
- Transfer Security
- Transport Security
- Configuring Transport Security
- Host and Client Security Configuration
- Client’s Security Configuration
- Message Security
- Configuring Message Security
- Other Security Modes
- Certificates
- Managing Certificates
- Exception Details
- Client Certificate Configuration
- Sending Credentials
- Username Credentials
- WCF Routing Service
- Service Contract and Implementation
- Service Configuration
- Hosting the Service
- Client Application
- Configuring the Router
- Router Configuration File
- Routing Contracts
- Message Filters
- EndpointName Message Filter
- EndPointName Router Configuration
- Incoming Endpoints and the Client
- Error Handling
- Appendix A – Learning Resources
- Appendix B. Hosting in IIS 7.5
- Internet Information Services
- Installing IIS 7.5
- WCF with IIS 7.5
- .NET Framework Version
- Registering ASP.NET
- A Service Contract
- A Website for the Service
- WCF ServiceTemplate
- Service Configuration
- Referencing the Class Library
- Examining the Service in the Browser
- WCR Clients
- Creating WCF Clients
- Service as an IIS Application
- Converting to an Application
- Configuring as an Application
- Moving a WCF Solution