You are previewing Learning WCF.
O'Reilly logo
Learning WCF

Book Description

This easy-to-use introduction to Microsoft Windows Communication Foundation (WCF) is ideal for developers who want to learn to build services on a company network or as part of an enterprise system. Built into Windows Vista and Longhorn, and available for Windows XP and Windows 2003, WCF provides a platform for service-oriented architecture (SOA) that enables secure and reliable communication among systems within an organization or across the Internet. With WCF, software developers can focus on their business applications and not the plumbing required to connect them. Furthermore, with WCF developers can learn a single programming API to achieve results previously provided by ASMX, Enterprise Services and .NET Remoting. Learning WCF removes the complexity of using this platform by providing detailed answers, explanations and code samples for the most common questions asked by software developers. Windows Communication Foundation (or WCF, formerly code name "Indigo") provides a set of programming APIs that make it easy to build and consume secure, reliable, and transacted services. This platform removes the need for developers to learn different technologies such as ASMX, Enterprise Services and .NET Remoting, to distribute system functionality on a corporate network or over the Internet. The first truly service-oriented platform, WCF provides innovations that decouple service design and development from deployment and distribution - creating a more flexible and agile environment. WCF also encapsulates all of the latest web service standards for addressing, security, reliability and more.

Table of Contents

  1. Learning WCF
    1. SPECIAL OFFER: Upgrade this ebook with O’Reilly
    2. A Note Regarding Supplemental Files
    3. Forewords
    4. Preface
      1. Who This Book Is For
      2. How This Book Is Organized
        1. Chapters Overview
        2. Labs and Code Samples
      3. Assumptions About the Reader
      4. System Requirements
      5. Your Working Directory
      6. Conventions Used in This Book
      7. Comments and Questions
      8. Safari® Enabled
      9. Acknowledgments
    5. 1. Hello Indigo
      1. 1.1. Service Oriented Architecture
        1. 1.1.1. From OOP to SOA
        2. 1.1.2. What Is a Service?
        3. 1.1.3. Tenets of SOA
          1. 1.1.3.1. Service boundaries are explicit
          2. 1.1.3.2. Services are autonomous
          3. 1.1.3.3. Clients and services share contracts, not code
          4. 1.1.3.4. Compatibility is based upon policy
        4. 1.1.4. Big SOA, Little SOA
      2. 1.2. WCF Services
      3. 1.3. Fundamental WCF Concepts
        1. 1.3.1. Message Serialization
        2. 1.3.2. Services
        3. 1.3.3. Hosting
        4. 1.3.4. Endpoints
        5. 1.3.5. Addresses
        6. 1.3.6. Bindings
        7. 1.3.7. Metadata
        8. 1.3.8. Proxies
        9. 1.3.9. Channels
        10. 1.3.10. Behaviors
      4. 1.4. Creating a New Service from Scratch
        1. 1.4.1. Lab: Creating Clients and Services Programmatically
          1. 1.4.1.1. Creating a new service
          2. 1.4.1.2. Hosting a service
          3. 1.4.1.3. Creating a proxy to invoke a service
        2. 1.4.2. Assembly Allocation
        3. 1.4.3. Defining a Service
        4. 1.4.4. Hosting a Service
        5. 1.4.5. Exposing Service Endpoints
          1. 1.4.5.1. Addresses
          2. 1.4.5.2. Bindings
          3. 1.4.5.3. Contracts
        6. 1.4.6. Creating a Client Proxy
      5. 1.5. Generating a Service and Client Proxy
        1. 1.5.1. Lab: Using Tools to Generate Clients and Services
          1. 1.5.1.1. Using the WCF Service template
          2. 1.5.1.2. Configuring service endpoints using the Service Configuration Editor
          3. 1.5.1.3. Generating a proxy with Add Service Reference
          4. 1.5.1.4. Creating a WCF Service Library
          5. 1.5.1.5. Generating a proxy using the Service Model Metadata Utility
        2. 1.5.2. Service Templates
        3. Service Testing Tools
        4. 1.5.3. ServiceModel Metadata Utility
        5. 1.5.4. Service Configuration Editor
        6. 1.5.5. ServiceModel Configuration
        7. 1.5.6. ServiceHost Initialization
        8. 1.5.7. Enabling Metadata Exchange
        9. 1.5.8. Working with Behaviors
          1. 1.5.8.1. Service behaviors
          2. 1.5.8.2. Endpoint behaviors
        10. 1.5.9. Proxy Initialization
      6. 1.6. Hosting a Service in IIS
        1. 1.6.1. Lab: Creating an IIS Host and Browsing Metadata
          1. 1.6.1.1. Creating a WCF Service web site
          2. 1.6.1.2. Browsing service metadata
          3. 1.6.1.3. Exporting metadata for proxy generation
        2. 1.6.2. Web Site Templates
        3. 1.6.3. @ServiceHost Declarations
        4. 1.6.4. Message-Based Activation
        5. 1.6.5. Browsing and Exporting Metadata
          1. 1.6.5.1. Browsing metadata
          2. 1.6.5.2. Exporting metadata
      7. 1.7. Exposing Multiple Service Endpoints
        1. 1.7.1. Lab: Hosting Multiple Services and Sharing Types
          1. 1.7.1.1. Implementing multiple contracts on a service
          2. 1.7.1.2. Hosting two services with multiple contracts
          3. 1.7.1.3. Consuming internal services using shared contracts
          4. 1.7.1.4. Consuming external services with a generated proxy
        2. 1.7.2. Implementing Multiple Contracts
        3. 1.7.3. Hosting Multiple Services
        4. 1.7.4. Proxy Generation for Multiple Contracts and Endpoints
        5. 1.7.5. Proxy Initialization and Lifetime
        6. 1.7.6. Sharing Service Contracts
        7. 1.7.7. Duplicating Operations
      8. 1.8. Summary
    6. 2. Contracts
      1. 2.1. Messaging Protocols
        1. 2.1.1. SOAP
        2. 2.1.2. WS*
      2. 2.2. Service Description
        1. 2.2.1. ServiceDescription
        2. 2.2.2. WSDL
        3. 2.2.3. WS-Policy
        4. 2.2.4. WS-MetadataExchange
      3. 2.3. WCF Contracts and Serialization
      4. 2.4. Service Contracts
        1. 2.4.1. Lab: Designing a Service Contract
          1. 2.4.1.1. Exploring service contract compatibility
          2. 2.4.1.2. Customizing message parameters
          3. 2.4.1.3. Modifying service operations and dealing with version tolerance
        2. 2.4.2. Mapping Services to WSDL
        3. 2.4.3. Designing Service Contracts
          1. 2.4.3.1. ServiceContractAttribute
          2. 2.4.3.2. OperationContractAttribute
          3. 2.4.3.3. MessageParameterAttribute
        4. 2.4.4. Versioning Service Contracts
          1. 2.4.4.1. Versioning with contract inheritance
          2. 2.4.4.2. Versioning with separate contracts
          3. 2.4.4.3. Strict versus non-strict versioning
      5. 2.5. Data Contracts
        1. 2.5.1. Lab: Working with Data Contracts
          1. 2.5.1.1. Creating a data contract
          2. 2.5.1.2. Customizing data contract serialization
          3. 2.5.1.3. Consuming data contracts at the client
          4. 2.5.1.4. Exploring version tolerance
        2. 2.5.2. Mapping Data Contracts to XSD Schema
        3. 2.5.3. Designing Data Contracts
          1. 2.5.3.1. DataContractAttribute
          2. 2.5.3.2. DataMemberAttribute
          3. 2.5.3.3. EnumMemberAttribute
          4. 2.5.3.4. CollectionDataContractAttribute
        4. 2.5.4. Mapping CLR Namespace to Schema Namespace
        5. 2.5.5. Configuring Known Types
          1. 2.5.5.1. KnownTypeAttribute
          2. 2.5.5.2. ServiceKnownTypeAttribute
          3. 2.5.5.3. Declarative known types
        6. 2.5.6. Versioning Data Contracts
          1. 2.5.6.1. IExtensibleDataObject
          2. 2.5.6.2. Explicit versioning
          3. 2.5.6.3. Versioning flow diagrams
        7. 2.5.7. Data Contracts As Operation Messages
      6. 2.6. Message Contracts
        1. 2.6.1. Lab: Controlling Message Serialization with Message Contracts
          1. 2.6.1.1. Creating message contracts
          2. 2.6.1.2. Implementing message contracts in a service
          3. 2.6.1.3. Using proxies and message contracts
        2. 2.6.2. Message Contracts and SOAP
        3. 2.6.3. Designing Message Contracts
          1. 2.6.3.1. MessageContractAttribute
          2. 2.6.3.2. MessageBodyMemberAttribute
          3. 2.6.3.3. MessageHeaderAttribute
        4. 2.6.4. Client Message Contracts
        5. 2.6.5. Versioning Message Contracts
      7. 2.7. Approaches to Serialization
        1. 2.7.1. Types Supporting Serialization
        2. 2.7.2. Serialization Format
          1. 2.7.2.1. Message Encoding
          2. 2.7.2.2. DataContractFormatAttribute
          3. 2.7.2.3. XmlSerializerFormatAttribute
        3. 2.7.3. Applying the XmlSerializer
          1. 2.7.3.1. Controlling serialization
          2. 2.7.3.2. Proxy generation and the XmlSerializer
        4. 2.7.4. Applying IXmlSerializable Types
          1. 2.7.4.1. Implementing IXmlSerializable
          2. 2.7.4.2. Supplying a schema
      8. 2.8. The Message Type
        1. 2.8.1. Lab: Working with Raw Messages
          1. 2.8.1.1. Using untyped messages in the service contract
          2. 2.8.1.2. Accessing message headers
          3. 2.8.1.3. Extending the message type
        2. 2.8.2. Untyped Messages and WSDL
        3. 2.8.3. Working with the Message Type
          1. 2.8.3.1. Creating messages
          2. 2.8.3.2. Accessing message headers
        4. 2.8.4. Filtering Messages
      9. 2.9. Summary
    7. 3. Bindings
      1. 3.1. How Bindings Work
        1. 3.1.1. Standard Bindings
        2. 3.1.2. Binding Features
        3. 3.1.3. Binding Elements
        4. 3.1.4. Building the Channel Stack
        5. 3.1.5. Web Service Protocols
        6. 3.1.6. Bindings and Metadata
        7. 3.1.7. Constraints on Binding Selection
      2. 3.2. Web Service Bindings
        1. 3.2.1. Lab: Exposing Web Services with BasicHttpBinding and WSHttpBinding
          1. 3.2.1.1. Exposing multiple web service endpoints
          2. 3.2.1.2. Adding a web reference for the legacy client
          3. 3.2.1.3. Adding a service reference for the non-legacy client
        2. 3.2.2. Choosing a Web Service Binding
        3. 3.2.3. BasicHttpBinding Features
          1. 3.2.3.1. BasicHttpBinding defaults
          2. 3.2.3.2. Customizing BasicHttpBinding
        4. 3.2.4. WSHttpBinding Features
          1. 3.2.4.1. WSHttpBinding defaults
          2. 3.2.4.2. Customizing WSHttpBinding
        5. 3.2.5. MessageVersion
        6. 3.2.6. Isolating SOAP 1.1 and SOAP 1.2 Endpoints
      3. 3.3. Connection-Oriented Bindings
        1. 3.3.1. Lab: Distributing Calls with NetNamedPipeBinding and NetTcpBinding
          1. 3.3.1.1. Setting up the lab
          2. 3.3.1.2. Moving from components to services
          3. 3.3.1.3. Crossing machine boundaries
        2. 3.3.2. Choosing a Connection-Oriented Binding
        3. 3.3.3. NetNamedPipeBinding Features
          1. 3.3.3.1. NetNamedPipeBinding defaults
          2. 3.3.3.2. Customizing NetNamedPipeBinding
        4. 3.3.4. NetTcpBinding Features
          1. 3.3.4.1. NetTcpBinding defaults
          2. 3.3.4.2. Customizing NetTcpBinding
        5. 3.3.5. Calling Services In-Process
        6. 3.3.6. Distribution of Services
      4. 3.4. One-Way and Duplex Communication
        1. 3.4.1. Message Exchange Patterns
          1. 3.4.1.1. Request-reply
          2. 3.4.1.2. One-way
          3. 3.4.1.3. Duplex
        2. 3.4.2. Working with Callbacks
          1. 3.4.2.1. Duplex proxies
          2. 3.4.2.2. DuplexChannelFactory<T>
          3. 3.4.2.3. Callback instance
          4. 3.4.2.4. Client endpoint
        3. 3.4.3. Lab: Duplex Communications over TCP and HTTP
          1. 3.4.3.1. Designing the callback contract
          2. 3.4.3.2. Issuing callbacks
          3. 3.4.3.3. Choosing a duplex-compatible binding
          4. 3.4.3.4. Implementing the callback contract
          5. 3.4.3.5. Issuing callbacks over WSDualHttpBinding
          6. 3.4.3.6. Callbacks and one-way operations
        4. 3.4.4. WSDualHttpBinding Features
          1. 3.4.4.1. WSDualHttpBinding defaults
          2. 3.4.4.2. Customizing WSDualHttpBinding
        5. 3.4.5. Services and Callback References
        6. 3.4.6. Callbacks and Concurrency
      5. 3.5. Large Message Transfers
        1. 3.5.1. Lab: Using MTOM to Handle Large Messages with Binary Data
        2. 3.5.2. Lab: Enabling Streaming for Large File Transfers
          1. 3.5.2.1. Streaming from the service
          2. 3.5.2.2. Streaming from the client
        3. 3.5.3. Handling Large Messages
          1. 3.5.3.1. Controlling payload size
          2. 3.5.3.2. Reducing memory consumption
        4. 3.5.4. Message Size Quotas
        5. 3.5.5. MTOM Encoding
        6. 3.5.6. Streaming
          1. 3.5.6.1. Designing a service contract for streaming
          2. 3.5.6.2. Enabling streaming
          3. 3.5.6.3. Who closes the stream?
          4. 3.5.6.4. Alternatives to streaming
      6. 3.6. Custom Bindings
        1. 3.6.1. CustomBinding Features
        2. 3.6.2. Creating a CustomBinding
          1. 3.6.2.1. Binary encoding over HTTP
          2. 3.6.2.2. SOAP 1.2 without addressing headers
      7. 3.7. Summary
    8. 4. Hosting
      1. 4.1. Hosting Features
      2. 4.2. ServiceHost
        1. 4.2.1. Initializing the ServiceHost
        2. 4.2.2. Declarative Configuration
        3. 4.2.3. Base Addresses
        4. 4.2.4. ServiceHost and ServiceDescription
        5. 4.2.5. Closing the ServiceHost
        6. 4.2.6. Communication Events
      3. 4.3. Self-Hosting
        1. 4.3.1. Console Applications
        2. 4.3.2. Windows Applications
        3. 4.3.3. Windows Services
      4. 4.4. Hosting on the UI Thread
        1. 4.4.1. Windows Applications and UI Threads
        2. 4.4.2. Synchronization Context
        3. 4.4.3. ServiceHost Lifetime
        4. 4.4.4. Lab: Working with a Windows Forms Host
          1. 4.4.4.1. Configuring the ServiceHost
          2. 4.4.4.2. Opening and closing the ServiceHost
          3. 4.4.4.3. Calling services on a non-UI thread
          4. 4.4.4.4. Calling services on the UI thread
          5. 4.4.4.5. Preventing services from joining the UI thread
        5. 4.4.5. Callbacks and the UI Thread
        6. 4.4.6. UI Hosting Scenarios
          1. 4.4.6.1. Coupling services to the host user interface
          2. 4.4.6.2. Exposing a reusable service user interface
          3. 4.4.6.3. Decoupling services from user interfaces
      5. 4.5. Hosting in a Windows Service
        1. 4.5.1. What Are Windows Services?
          1. 4.5.1.1. Controlling service startup
          2. 4.5.1.2. Runtime identities
          3. 4.5.1.3. Recovery
        2. 4.5.2. Creating and Installing Windows Services
          1. 4.5.2.1. Extending ServiceBase
          2. 4.5.2.2. Event log access
          3. 4.5.2.3. Registering the Windows service
          4. 4.5.2.4. Providing an installer
        3. 4.5.3. Lab: Creating a Windows Service Host
          1. 4.5.3.1. Creating a new Windows Service
          2. 4.5.3.2. Handling start and stop events
          3. 4.5.3.3. Creating a Windows service installer
          4. 4.5.3.4. Generating the client proxy
        4. 4.5.4. Considerations for WCF Services
        5. 4.5.5. Windows Service Hosting Scenarios
      6. 4.6. Hosting in IIS 6.0
        1. 4.6.1. IIS Service Endpoints
        2. 4.6.2. IIS 6.0 Hosting Architecture
        3. 4.6.3. ASP.NET Compatibility Mode
      7. 4.7. IIS 7.0 and Windows Activation Service
        1. 4.7.1. WAS Hosting Architecture
        2. 4.7.2. Installing IIS 7.0, WAS, and WCF Communications
        3. 4.7.3. Configuring IIS 7.0 and WAS
        4. 4.7.4. Hosting WCF Services with WAS
      8. 4.8. Choosing the Right Hosting Environment
      9. 4.9. Summary
    9. 5. Instancing and Concurrency
      1. 5.1. OperationContext
      2. 5.2. Instancing
        1. 5.2.1. PerCall Services
        2. 5.2.2. PerSession Services
          1. 5.2.2.1. Requiring sessions
          2. 5.2.2.2. Session identifier
          3. 5.2.2.3. Session lifetime
          4. 5.2.2.4. Exception handling
        3. 5.2.3. Singleton Services
        4. 5.2.4. Lab: Controlling Service Instancing
          1. 5.2.4.1. Working with PerCall services
          2. 5.2.4.2. Working with sessions
          3. 5.2.4.3. Working with singletons
      3. 5.3. Concurrency
        1. 5.3.1. Single Concurrency Mode
        2. 5.3.2. Reentrant Concurrency Mode
        3. 5.3.3. Multiple Concurrency Mode
        4. 5.3.4. Custom Synchronization
        5. 5.3.5. .NET Synchronization Techniques
        6. 5.3.6. Asynchronous Proxies
        7. 5.3.7. Lab: Protecting Shared Resources from Concurrent Access
          1. 5.3.7.1. Generating an asynchronous proxy
          2. 5.3.7.2. Allowing concurrent access to the singleton
          3. 5.3.7.3. Adding manual synchronization with global locks
          4. 5.3.7.4. Adding more granular synchronization for increased throughput
      4. 5.4. Instance Throttling
        1. 5.4.1. Throttling PerCall Services
        2. 5.4.2. Throttling Sessions
        3. 5.4.3. Throttling Singletons
      5. 5.5. Load Balancing and Failover
      6. 5.6. Summary
    10. 6. Reliability
      1. 6.1. Reliable Sessions
        1. 6.1.1. Configuring Reliable Sessions
          1. 6.1.1.1. Standard bindings
          2. 6.1.1.2. Custom bindings
          3. 6.1.1.3. Requiring ordered delivery
          4. 6.1.1.4. Client configuration
        2. 6.1.2. How Reliable Sessions Work
          1. 6.1.2.1. Session identifier
          2. 6.1.2.2. Session lifetime
          3. 6.1.2.3. Retry attempts
          4. 6.1.2.4. Session throttling
        3. 6.1.3. WS-ReliableMessaging Protocol
          1. 6.1.3.1. Message flow
          2. 6.1.3.2. CreateSequence
          3. 6.1.3.3. CreateSequenceResponse
          4. 6.1.3.4. SequenceAcknowledgement
          5. 6.1.3.5. LastMessage
          6. 6.1.3.6. TerminateSequence
        4. 6.1.4. Lab: Working with Reliable Sessions
          1. 6.1.4.1. Tracing reliable sessions messages
          2. 6.1.4.2. Testing reliable session retries
      2. 6.2. Transactions
        1. 6.2.1. Transaction Management
          1. 6.2.1.1. Two-phase commit protocol
          2. 6.2.1.2. Durable versus volatile resource managers
          3. 6.2.1.3. TransactionScope
          4. 6.2.1.4. Lightweight Transaction Manager
          5. 6.2.1.5. Kernel Transaction Manager
          6. 6.2.1.6. Distributed Transaction Coordinator
          7. 6.2.1.7. WS-AtomicTransaction and WS-Coordination protocols
          8. 6.2.1.8. Enabling WS-AT
        2. 6.2.2. Transactions and System Tiers
        3. 6.2.3. Configuring WCF Transactions
          1. 6.2.3.1. Enabling transaction flow
          2. 6.2.3.2. Selecting a transaction protocol
          3. 6.2.3.3. Transaction flow options
          4. 6.2.3.4. Service operations and transactions
          5. 6.2.3.5. Controlling IsolationLevel
          6. 6.2.3.6. Transaction timeout
          7. 6.2.3.7. Client configuration
          8. 6.2.3.8. Transactions and sessions
        4. 6.2.4. Lab: Configuring WCF Transactions
          1. 6.2.4.1. Testing service calls without transactions
          2. 6.2.4.2. Requiring client transactions
          3. 6.2.4.3. Automating service transactions
          4. 6.2.4.4. Rejecting client transactions
      3. 6.3. Queued Calls
        1. 6.3.1. MSMQ Overview
          1. 6.3.1.1. Private and public queues
          2. 6.3.1.2. Transactional queues
          3. 6.3.1.3. Delivery failure
          4. 6.3.1.4. Security
          5. 6.3.1.5. MSMQ management console
          6. 6.3.1.6. System.Messaging
        2. 6.3.2. NetMsmqBinding Features
        3. 6.3.3. Queued Service Contracts
        4. 6.3.4. Durable Queues
        5. 6.3.5. Transactional Queues
          1. 6.3.5.1. Exactly once delivery
          2. 6.3.5.2. Client transactions
          3. 6.3.5.3. Queue-to-queue transactions
          4. 6.3.5.4. Queued service transactions
        6. 6.3.6. Transactions and Delivery Failures
          1. 6.3.6.1. Delivery retries
          2. 6.3.6.2. Time-to-live
          3. 6.3.6.3. Poison messages
          4. 6.3.6.4. Poison message queue
          5. 6.3.6.5. Dead letter queues
        7. 6.3.7. Security
        8. 6.3.8. MsmqIntegrationBinding
        9. 6.3.9. Lab: Creating a Queued Service
          1. 6.3.9.1. Exposing an MSMQ endpoint
          2. 6.3.9.2. Requiring MSMQ
          3. 6.3.9.3. Testing offline messaging
          4. 6.3.9.4. Testing exception handling
      4. 6.4. Summary
    11. 7. Security
      1. 7.1. WCF Security Overview
        1. 7.1.1. Security Policy
        2. 7.1.2. Binding Security
          1. 7.1.2.1. Default security settings
          2. 7.1.2.2. Security mode
          3. 7.1.2.3. Client credential type
          4. 7.1.2.4. Advanced dettings
        3. 7.1.3. Supplying Credentials
          1. 7.1.3.1. Client credentials
          2. 7.1.3.2. Service credentials
        4. 7.1.4. Message Protection
          1. 7.1.4.1. Protection level
          2. 7.1.4.2. Algorithm suite
        5. 7.1.5. Authentication, Authorization, and Identities
          1. 7.1.5.1. ServiceSecurityContext
          2. 7.1.5.2. Security tokens and authentication
          3. 7.1.5.3. Role-based authorization
          4. 7.1.5.4. Impersonation
        6. 7.1.6. WCF Security Summary
      2. 7.2. Securing Intranet Services
        1. 7.2.1. Lab: Authenticating and Authorizing Windows Credentials
          1. 7.2.1.1. Authenticating with Windows credentials
          2. 7.2.1.2. Initializing the proxy with Windows credentials
          3. 7.2.1.3. Applying Windows role-based permission demands
        2. 7.2.2. NetNamedPipeBinding Security Features
        3. 7.2.3. NetTcpBinding Security Features
        4. 7.2.4. Windows Authentication and Authorization
        5. 7.2.5. Windows Role-Based Security
        6. 7.2.6. Windows Client Credentials
      3. 7.3. Securing Internet Services
        1. 7.3.1. Lab: Authenticating and Authorizing UserName Credentials
          1. 7.3.1.1. Creating two service endpoints
          2. 7.3.1.2. Generating the client proxy
          3. 7.3.1.3. Configuring binding security
          4. 7.3.1.4. Initializing proxies with UserName credentials
          5. 7.3.1.5. Configuring ASP.NET authentication and authorization
          6. 7.3.1.6. Applying custom role-based permission demands
        2. 7.3.2. BasicHttpBinding Security Features
        3. 7.3.3. WSHttpBinding Security Features
        4. 7.3.4. Negotiation
        5. 7.3.5. Secure Sessions
        6. 7.3.6. ASP.NET Authentication and Authorization
          1. 7.3.6.1. Configuring ASP.NET providers
          2. 7.3.6.2. Custom password validators
        7. 7.3.7. Custom Role-Based Security
        8. 7.3.8. UserName Client Credentials
      4. 7.4. Working with Certificates
        1. 7.4.1. Understanding Certificates, Digital Signatures, and Encryption
        2. 7.4.2. Signing and Encrypting Messages
        3. 7.4.3. Service Certificates and Negotiation
        4. 7.4.4. Certificate Authentication
        5. 7.4.5. Certificate Authorization
      5. 7.5. Building a Claims-Based Security Model
        1. 7.5.1. Security Tokens and Claims
        2. 7.5.2. AuthorizationContext
        3. 7.5.3. Custom Claims
        4. 7.5.4. Custom Authorization Policies
        5. 7.5.5. Lab: Creating a Custom Authorization Policy
          1. 7.5.5.1. Implementing IAuthorizationPolicy
          2. 7.5.5.2. Authorizing custom claims
          3. 7.5.5.3. Applying custom security extensions
      6. 7.6. Exploring Federated Security
        1. 7.6.1. Security Token Services
        2. 7.6.2. SAML Tokens
        3. 7.6.3. Windows CardSpace
        4. 7.6.4. LAB: Working with WSFederationHttpBinding
          1. 7.6.4.1. Configuring WSFederationHttpBinding
          2. 7.6.4.2. Creating an information card in CardSpace
          3. 7.6.4.3. Evaluating CardSpace claims
        5. 7.6.5. WSFederationHttpBinding Security Features
      7. 7.7. Summary
    12. 8. Exceptions and Faults
      1. 8.1. SOAP Faults
        1. 8.1.1. Fault Versions
        2. 8.1.2. Faults and WSDL
      2. 8.2. WCF Exception Handling
        1. 8.2.1. Fault Exceptions
        2. 8.2.2. Service Exception Handling
        3. 8.2.3. Client Exception Handling
      3. 8.3. Exceptions and Debugging
        1. 8.3.1. Lab: Working with Uncaught Exceptions
        2. 8.3.2. Debugging Behavior
        3. 8.3.3. Uncaught Exceptions and SOAP Faults
        4. 8.3.4. Clients and Faulted Channels
      4. 8.4. Fault Contracts
        1. 8.4.1. Lab: Throwing Faults and Declaring Fault Contracts
        2. 8.4.2. Throwing Faults
          1. 8.4.2.1. FaultException
          2. 8.4.2.2. FaultException<T>
          3. 8.4.2.3. MessageFault
        3. 8.4.3. Declared Faults
        4. 8.4.4. Fault Contracts and Complex Types
        5. 8.4.5. Mapping MessageFault to SOAP Fault
          1. 8.4.5.1. Creating SOAP 1.1 compliant faults
        6. 8.4.6. Clients and FaultContracts
      5. 8.5. IErrorHandler
        1. 8.5.1. Lab: Intercepting Uncaught Exceptions with IErrorHandler
          1. 8.5.1.1. Implementing IErrorHandler
          2. 8.5.1.2. Configuring an error handler
          3. 8.5.1.3. Using data contracts as fault contracts
        2. 8.5.2. IErrorHandler
        3. 8.5.3. Configuring Error Handlers
          1. 8.5.3.1. Implementing IServiceBehavior
          2. 8.5.3.2. Attributes and IServiceBehavior
          3. 8.5.3.3. Extending ServiceHost
      6. 8.6. Summary
    13. A. Setup Instructions
      1. A.1. Database Setup
        1. A.1.1. Choosing a Database Engine
        2. A.1.2. Installing Database Scripts
        3. A.1.3. Database Connection Strings
        4. A.1.4. Database Security
      2. A.2. ASP.NET Provider Model Setup
        1. A.2.1. Generating ASP.NET Provider Tables
        2. A.2.2. ASP.NET Provider Connection Strings
        3. A.2.3. Creating Sample Users and Roles
      3. A.3. Certificate Setup
        1. A.3.1. Sample Certificates
        2. A.3.2. Certificates Console
        3. A.3.3. Importing Certificates
        4. A.3.4. Certificate Security
        5. A.3.5. Setting Up an SSL Certificate
          1. A.3.5.1. Instructions for IIS 5.1 and 6.0
          2. A.3.5.2. Instructions for IIS 7.0
        6. A.3.6. Generating Certificates
      4. A.4. IIS Application Directories
        1. A.4.1. Instructions for IIS 5.1 and 6.0
        2. A.4.2. Instructions for IIS 7.0
    14. B. ASP.NET Meets CardSpace
      1. B.1. Information Cards and CardSpace: A Brief Tour
      2. B.2. Identity Metasystem Participants and Browser Flow
      3. B.3. Let's Log In with CardSpace!
      4. B.4. Processing the Token
      5. B.5. Associating Cards with User Accounts
      6. B.6. Creating a Dual Purpose Login Page
      7. B.7. Conclusion
    15. Index
    16. About the Author
    17. Colophon
    18. SPECIAL OFFER: Upgrade this ebook with O’Reilly