Professional WCF Programming: .NET Development with the Windows® Communication Foundation

Book description

  • Part of the new .NET 3.0 extensions to .NET 2.0, WCF provides a unified platform for building and running connected systems and will be used by almost every .NET or SQL Server developer

  • Targeted to experienced developers who want to build service-oriented and transactional applications on the Microsoft platform that offer reliable and secure transactional messaging

  • Addresses the WCF technologies as well as the next generation of configuring and deploying network-distributed services

  • Key topics discussed include binding, contracts, clients, services, security, deployment, management, and hosting

  • Table of contents

    1. Copyright
    2. About the Author
    3. Credits
    4. Acknowledgments
    5. Introduction
      1. 0.1. Who This Book Is For
      2. 0.2. What This Book Covers
      3. 0.3. How This Book Is Structured
      4. 0.4. What You Need To Read This Book
      5. 0.5. Conventions
      6. 0.6. Source Code
      7. 0.7. Errata
      8. 0.8. p2p.wrox.com
    6. I. Introduction to Windows Communication Foundation
      1. 1. Windows Communication Foundation Overview
        1. 1.1. The Need for SOA
          1. 1.1.1. A Look Back
          2. 1.1.2. Understanding Service Orientation
          3. 1.1.3. Service-Oriented Architecture Principles
            1. 1.1.3.1. Explicit Boundaries
            2. 1.1.3.2. Autonomous Services
            3. 1.1.3.3. Policy-Based Compatibility
            4. 1.1.3.4. Shared Schemas and Contracts
          4. 1.1.4. Microsoft's Commitment to SOA
          5. 1.1.5. SOA Wrap-up
        2. 1.2. Why Windows Communication Foundation
          1. 1.2.1. WCF Architecture
            1. 1.2.1.1. Contracts
              1. 1.2.1.1.1. Data
              2. 1.2.1.1.2. Message
              3. 1.2.1.1.3. Service
              4. 1.2.1.1.4. Policy and Binding
            2. 1.2.1.2. Service Runtime
            3. 1.2.1.3. Messaging
            4. 1.2.1.4. Activation and Hosting
          2. 1.2.2. The Makeup of WCF
            1. 1.2.2.1. Programming Model
            2. 1.2.2.2. Scalability
            3. 1.2.2.3. Interoperability
            4. 1.2.2.4. Enhanced Communication
            5. 1.2.2.5. Enterprise Enabled
          3. 1.2.3. WCF Features
            1. 1.2.3.1. Transactions
            2. 1.2.3.2. Hosting
            3. 1.2.3.3. Security
            4. 1.2.3.4. Queuing
        3. 1.3. Summary
      2. 2. Windows Communication Foundation Concepts
        1. 2.1. Messages
          1. 2.1.1. Message Structure
            1. 2.1.1.1. SOAP Envelope
            2. 2.1.1.2. SOAP Header
            3. 2.1.1.3. SOAP Body
          2. 2.1.2. Messaging Programs
            1. 2.1.2.1. Clients
            2. 2.1.2.2. Services
              1. 2.1.2.2.1. Service Chains
            3. 2.1.2.3. Intermediaries
          3. 2.1.3. Messaging Patterns
            1. 2.1.3.1. Simplex
            2. 2.1.3.2. Duplex
            3. 2.1.3.3. Request-Reply
        2. 2.2. Channels
          1. 2.2.1. Channel Stacks
            1. 2.2.1.1. Security
            2. 2.2.1.2. Interoperability
            3. 2.2.1.3. Message Patterns
            4. 2.2.1.4. Transports
        3. 2.3. Services
          1. 2.3.1. Endpoint
          2. 2.3.2. Addresses
          3. 2.3.3. Bindings
          4. 2.3.4. Contracts
            1. 2.3.4.1. Service Contracts
            2. 2.3.4.2. Message Contracts
            3. 2.3.4.3. Data Contracts
        4. 2.4. Behaviors
        5. 2.5. Summary
      3. 3. Understanding Windows Communication Foundation
        1. 3.1. WCF Programming Model
          1. 3.1.1. SO or OO
          2. 3.1.2. Service Model
            1. 3.1.2.1. System.ServiceModel
              1. 3.1.2.1.1. System.ServiceModel.Channels
            2. 3.1.2.2. System.Transactions
            3. 3.1.2.3. SvcUtil.exe
              1. 3.1.2.3.1. Common Usages
              2. 3.1.2.3.2. Code Generation
              3. 3.1.2.3.3. Metadata Export
              4. 3.1.2.3.4. Serialization / Message
              5. 3.1.2.3.5. Advanced
              6. 3.1.2.3.6. Miscellaneous
          3. 3.1.3. WCF Programming Methods
            1. 3.1.3.1. Declarative
            2. 3.1.3.2. Explicit
            3. 3.1.3.3. Configuration
            4. 3.1.3.4. Which One Wins?
          4. 3.1.4. WCF Programming Levels
            1. 3.1.4.1. Typed
            2. 3.1.4.2. Untyped
            3. 3.1.4.3. Messaging
          5. 3.1.5. The Development Process
          6. 3.1.6. And the Answer Is ...
        2. 3.2. Installing WCF
        3. 3.3. Creating Your First WCF Service
          1. 3.3.1. Service Code
          2. 3.3.2. Service.svc
          3. 3.3.3. Web.config
        4. 3.4. Summary
    7. II. Programming Windows Communication Foundation
      1. 4. Addresses
        1. 4.1. WCF Addresses
          1. 4.1.1. Address Types
            1. 4.1.1.1. Endpoint Address
            2. 4.1.1.2. Base Address
            3. 4.1.1.3. MEX Address
          2. 4.1.2. Address Formats
            1. 4.1.2.1. HTTP Address
            2. 4.1.2.2. HTTPS Address
            3. 4.1.2.3. TCP Address
            4. 4.1.2.4. MSMQ Address
            5. 4.1.2.5. Named Pipe Address
            6. 4.1.2.6. IIS Address
        2. 4.2. Programming WCF Addresses
          1. 4.2.1. EndpointAddress Class
            1. 4.2.1.1. Identity Property
            2. 4.2.1.2. Headers Collection
          2. 4.2.2. Programming Addresses
            1. 4.2.2.1. Base Address
            2. 4.2.2.2. Endpoint Address
              1. 4.2.2.2.1. Specifying in a Configuration File
              2. 4.2.2.2.2. Specifying in Code
            3. 4.2.2.3. Relative Address
        3. 4.3. Summary
      2. 5. Understanding and Programming WCF Bindings
        1. 5.1. Understanding WCF Bindings
          1. 5.1.1. Predefined Bindings
            1. 5.1.1.1. BasicHttpBinding
              1. 5.1.1.1.1. BasicHttpBinding Properties
              2. 5.1.1.1.2. Notes of Interest
            2. 5.1.1.2. WSHttpBinding
              1. 5.1.1.2.1. WSHttpBinding Properties
            3. 5.1.1.3. WSDualHttpBinding
              1. 5.1.1.3.1. WSDualHttpBinding Properties
              2. 5.1.1.3.2. Notes of Interest
            4. 5.1.1.4. WSFederationHttpBinding
              1. 5.1.1.4.1. WSFederationHttpBinding Properties
            5. 5.1.1.5. NetTcpBinding
              1. 5.1.1.5.1. NetTcpBinding Properties
              2. 5.1.1.5.2. Notes of Interest
            6. 5.1.1.6. NetNamedPipeBinding
              1. 5.1.1.6.1. NetNamedPipeBinding Properties
            7. 5.1.1.7. NetMsmqBinding
              1. 5.1.1.7.1. NetMsmqBinding Properties
              2. 5.1.1.7.2. Notes of Interest
            8. 5.1.1.8. NetPeerTcpBinding
              1. 5.1.1.8.1. NetPeerTcpBinding Properties
            9. 5.1.1.9. MsmqIntegrationBinding
              1. 5.1.1.9.1. MsmqIntegrationBinding Properties
        2. 5.2. Programming WCF Bindings
          1. 5.2.1. Using Code
          2. 5.2.2. Using Configuration Files
        3. 5.3. Summary
      3. 6. Understanding and Programming WCF Contracts
        1. 6.1. WCF Contracts
          1. 6.1.1. Contracts and Their Relationship with the CLR
          2. 6.1.2. Service Contracts
            1. 6.1.2.1. [ServiceContract] Attribute
              1. 6.1.2.1.1. CallbackContract
              2. 6.1.2.1.2. ConfigurationName
              3. 6.1.2.1.3. Name
              4. 6.1.2.1.4. Namespace
              5. 6.1.2.1.5. ProtectionLevel
              6. 6.1.2.1.6. SessionMode
          3. 6.1.3. Service Types
            1. 6.1.3.1. Typed
            2. 6.1.3.2. Typed Message
            3. 6.1.3.3. Untyped
            4. 6.1.3.4. [OperationContract] Attribute
              1. 6.1.3.4.1. Action
              2. 6.1.3.4.2. AsyncPattern
              3. 6.1.3.4.3. IsInitiating
              4. 6.1.3.4.4. IsOneWay
              5. 6.1.3.4.5. IsTerminating
              6. 6.1.3.4.6. Name
              7. 6.1.3.4.7. ProtectionLevel
              8. 6.1.3.4.8. ReplyAction
          4. 6.1.4. Data Contracts
            1. 6.1.4.1. [DataContract] Attribute
              1. 6.1.4.1.1. Name
              2. 6.1.4.1.2. Namespace
            2. 6.1.4.2. [DataMember] Attribute
              1. 6.1.4.2.1. EmitDefaultValue
              2. 6.1.4.2.2. IsRequired
              3. 6.1.4.2.3. Name
              4. 6.1.4.2.4. Order
            3. 6.1.4.3. [KnownType] Attribute
              1. 6.1.4.3.1. MethodName
              2. 6.1.4.3.2. Type
          5. 6.1.5. Message Contracts
            1. 6.1.5.1. [MessageContract] Attribute
              1. 6.1.5.1.1. HasProtectionLevel
              2. 6.1.5.1.2. IsWrapped
              3. 6.1.5.1.3. PretectionLevel
              4. 6.1.5.1.4. WrapperName
              5. 6.1.5.1.5. WrapperNamespace
            2. 6.1.5.2. [MessageHeader] Attribute
              1. 6.1.5.2.1. Actor
              2. 6.1.5.2.2. MustUnderstand
              3. 6.1.5.2.3. Name
              4. 6.1.5.2.4. Namespace
              5. 6.1.5.2.5. Relay
            3. 6.1.5.3. [MessageBodyMember] Attribute
              1. 6.1.5.3.1. Name
              2. 6.1.5.3.2. Order
            4. 6.1.5.4. [MessageProperty] Attribute
              1. 6.1.5.4.1. Name
        2. 6.2. Programming WCF Contracts
          1. 6.2.1. Data Contract
          2. 6.2.2. Message Contract
        3. 6.3. Summary
      4. 7. Clients
        1. 7.1. Client Architecture
          1. 7.1.1. Client Objects
            1. 7.1.1.1. ICommunicationObject
            2. 7.1.1.2. IExtensibleObject
          2. 7.1.2. Client Channels
            1. 7.1.2.1. IClientChannel
            2. 7.1.2.2. IContextChannel
          3. 7.1.3. Channel Factories
            1. 7.1.3.1. ChannelFactory Class
              1. 7.1.3.1.1. Constructors
              2. 7.1.3.1.2. Properties
              3. 7.1.3.1.3. Methods
              4. 7.1.3.1.4. CreateChannel Method
        2. 7.2. Client Communication Patterns
          1. 7.2.1. One-Way
          2. 7.2.2. Request-Reply
          3. 7.2.3. Duplex
            1. 7.2.3.1. Service
            2. 7.2.3.2. Client
              1. 7.2.3.2.1. Duplex Client Using the DuplexChannelFactory
          4. 7.2.4. Asynchronous
            1. 7.2.4.1. Service
            2. 7.2.4.2. Client
        3. 7.3. Creating Client Code
          1. 7.3.1. Generating Client Code
        4. 7.4. Defining Client Bindings and Endpoints
        5. 7.5. Typed versus Untyped Services
          1. 7.5.1. Invoking Operations of a Typed Services
          2. 7.5.2. Invoking Operations of an Untyped Service
        6. 7.6. Useful Information
          1. 7.6.1. Initializing Channels Interactively
          2. 7.6.2. Session and Channel Duration
          3. 7.6.3. Blocking Issues
          4. 7.6.4. Exception Handling
        7. 7.7. Client Programming Example
          1. 7.7.1. ChannelFactory
          2. 7.7.2. Duplex
        8. 7.8. Summary
      5. 8. Services
        1. 8.1. Overview
          1. 8.1.1. Service Types
            1. 8.1.1.1. Typed
            2. 8.1.1.2. Untyped
            3. 8.1.1.3. Typed Message
          2. 8.1.2. Service Contracts
          3. 8.1.3. Service Endpoints
            1. 8.1.3.1. Specifying in Code
            2. 8.1.3.2. Specifying in Configuration
        2. 8.2. Service Behaviors
          1. 8.2.1. ServiceBehavior Attribute
            1. 8.2.1.1. AddressFilterMode
            2. 8.2.1.2. AutomaticSessionShutdown
            3. 8.2.1.3. ConcurrencyMode
            4. 8.2.1.4. ConfigurationName
            5. 8.2.1.5. IgnoreExtensionDataObject
            6. 8.2.1.6. IncludeExceptionDetailInFaults
            7. 8.2.1.7. InstanceContextMode
            8. 8.2.1.8. ReleaseServiceInstanceOnTransactionComplete
            9. 8.2.1.9. TransactionAutoCompleteOnSessionClose
            10. 8.2.1.10. TransactionIsolationLevel
            11. 8.2.1.11. TransactionTimeout
            12. 8.2.1.12. UseSynchronizedContext
            13. 8.2.1.13. ValidateMustUnderstand
          2. 8.2.2. OperationBehavior Attribute
            1. 8.2.2.1. AutoDisposeParameters
            2. 8.2.2.2. Impersonation
            3. 8.2.2.3. ReleaseInstanceMode
            4. 8.2.2.4. TransactionAutoComplete
            5. 8.2.2.5. TransactionScopeRequired
          3. 8.2.3. Using Configuration to Specify Behaviors
            1. 8.2.3.1. Throttling
        3. 8.3. InstanceContext
        4. 8.4. Handling Exceptions
          1. 8.4.1. FaultException
          2. 8.4.2. FaultContract Attribute
        5. 8.5. Programming Example
        6. 8.6. Summary
      6. 9. Transactions and Reliable Sessions
        1. 9.1. Transactions
          1. 9.1.1. Overview
            1. 9.1.1.1. Atomic
            2. 9.1.1.2. Consistent
            3. 9.1.1.3. Isolated
            4. 9.1.1.4. Durable
          2. 9.1.2. Transaction Attributes in System.ServiceModel
            1. 9.1.2.1. ServiceBehavior Attribute
            2. 9.1.2.2. OperationBehavior Attribute
            3. 9.1.2.3. TransactionFlow Attribute
            4. 9.1.2.4. WS-Atomic Transaction
            5. 9.1.2.5. Specifying Transactions Through Configuration
        2. 9.2. Reliable Sessions
          1. 9.2.1. Overview
          2. 9.2.2. Message Exchange
          3. 9.2.3. Securing Messages
          4. 9.2.4. Queues
            1. 9.2.4.1. WCF and Queues
            2. 9.2.4.2. Queuing Best Practices
        3. 9.3. Summary
      7. 10. Security
        1. 10.1. Security Overview
          1. 10.1.1. Concepts
            1. 10.1.1.1. Integrity
            2. 10.1.1.2. Confidentiality
            3. 10.1.1.3. Authentication
            4. 10.1.1.4. Authorization
          2. 10.1.2. Why WCF Security?
            1. 10.1.2.1. Transfer Security
            2. 10.1.2.2. Control Access / Authorization
              1. 10.1.2.2.1. PrinciplePermission Attribute
              2. 10.1.2.2.2. ASP.NET Membership and Role Provider
              3. 10.1.2.2.3. Authorization Manager
              4. 10.1.2.2.4. Identity Model
            3. 10.1.2.3. Auditing
          3. 10.1.3. Credentials
        2. 10.2. Security Behaviors and Bindings
          1. 10.2.1. Security Behaviors
            1. 10.2.1.1. Service Credentials
            2. 10.2.1.2. Client Credentials
            3. 10.2.1.3. Service Authorization
            4. 10.2.1.4. Service Audit
          2. 10.2.2. Bindings
            1. 10.2.2.1. BasicHttpBinding
            2. 10.2.2.2. WSHttpBinding
            3. 10.2.2.3. WSDualHttpBinding
            4. 10.2.2.4. NetTcpBinding
            5. 10.2.2.5. NetNamedPipeBinding
            6. 10.2.2.6. MsmqIntegrationBinding
            7. 10.2.2.7. NetMsmqBinding
            8. 10.2.2.8. WSFederationBinding
        3. 10.3. Securing Clients and Services
        4. 10.4. Best Practices
        5. 10.5. Summary
      8. 11. Customizing Windows Communication Foundation
        1. 11.1. Extending ServiceHost and Service Model Layer
          1. 11.1.1. Client
            1. 11.1.1.1. ClientRuntime Class
            2. 11.1.1.2. ClientOperation Class
          2. 11.1.2. Dispatcher
            1. 11.1.2.1. DispatchRuntime Class
            2. 11.1.2.2. DispatchOperation Class
          3. 11.1.3. Behaviors
        2. 11.2. Extending the Channel Layer
          1. 11.2.1. Client Channel
          2. 11.2.2. Service Channel
          3. 11.2.3. Channel Development
            1. 11.2.3.1. Choosing Message Exchange Pattern
            2. 11.2.3.2. Channel Factory and Channel Listener
            3. 11.2.3.3. Add Binding Element
        3. 11.3. Extending Bindings
          1. 11.3.1. Building Custom Bindings
            1. 11.3.1.1. Modifying a WCF Built-in Binding
          2. 11.3.2. User-Defined Bindings
        4. 11.4. Summary
      9. 12. Interoperability and Integration
        1. 12.1. Interoperability
          1. 12.1.1. Web Service Protocol Support
          2. 12.1.2. WSE (Web Service Enhancements)
            1. 12.1.2.1. WCF Service
            2. 12.1.2.2. WCF Client
          3. 12.1.3. ASP.NET Web Services
            1. 12.1.3.1. WCF/ASP.NET Compatible Endpoints
              1. 12.1.3.1.1. Endpoint via Code
              2. 12.1.3.1.2. Endpoint via Configuration
        2. 12.2. Integration
          1. 12.2.1. COM+
            1. 12.2.1.1. COM+ Service Model Configuration Tool
          2. 12.2.2. MSMQ
            1. 12.2.2.1. WCF Service and MSMQ Client
        3. 12.3. Summary
    8. III. Deploying Windows Communication Foundation
      1. 13. Deploying Windows Communication Foundation
        1. 13.1. Installing WCF Services
          1. 13.1.1. Support Operating Systems
          2. 13.1.2. Required Software
            1. 13.1.2.1. .NET Framework
            2. 13.1.2.2. Internet Information Services
            3. 13.1.2.3. Microsoft Message Queuing
          3. 13.1.3. Installing the WCF Service
            1. 13.1.3.1. IIS
            2. 13.1.3.2. Windows Service
          4. 13.1.4. WCF Service Configurations
        2. 13.2. Upgrading Services
        3. 13.3. Troubleshooting WCF Installations
          1. 13.3.1. Client/Service Communication
          2. 13.3.2. Unexpected Service Behavior
          3. 13.3.3. Exceptions
        4. 13.4. Summary
      2. 14. Managing Windows Communication Foundation
        1. 14.1. Tracing
          1. 14.1.1. End-to-End Tracing
          2. 14.1.2. Service Trace Viewer
            1. 14.1.2.1. Activity
            2. 14.1.2.2. Project
            3. 14.1.2.3. Graph
            4. 14.1.2.4. Filtering Traces
              1. 14.1.2.4.1. Filter Toolbar
              2. 14.1.2.4.2. Built-in Filter Options
              3. 14.1.2.4.3. Custom Filters
              4. 14.1.2.4.4. Creating a Custom Filter via the Template Wizard
              5. 14.1.2.4.5. Creating a Custom Wizard Manually
        2. 14.2. Message Logging
        3. 14.3. Service Configuration Editor
          1. 14.3.1. Configuration
            1. 14.3.1.1. Services
            2. 14.3.1.2. Client
            3. 14.3.1.3. Bindings
            4. 14.3.1.4. Diagnostics
            5. 14.3.1.5. Advanced
              1. 14.3.1.5.1. Endpoint Behavior
              2. 14.3.1.5.2. Service Behavior
              3. 14.3.1.5.3. Extensions
          2. 14.3.2. Tasks
          3. 14.3.3. Detail
        4. 14.4. Performance Counters
        5. 14.5. Summary
      3. 15. Hosting Windows Communication Foundation Services
        1. 15.1. Hosting versus Self-Hosting
          1. 15.1.1. Hosting
          2. 15.1.2. Self-Hosting
          3. 15.1.3. Quick Comparison
        2. 15.2. Hosting Options
          1. 15.2.1. Hosting in IIS
            1. 15.2.1.1. Benefits
            2. 15.2.1.2. Service Deployment
              1. 15.2.1.2.1. WCF/ASP.NET Side-by-Side
              2. 15.2.1.2.2. WCF/ASP.NET Compatibility Mode
            3. 15.2.1.3. Best Practices
          2. 15.2.2. Hosting in Managed Code
          3. 15.2.3. Hosting in a Windows Service
          4. 15.2.4. Hosting in WAS
        3. 15.3. Hosting Example
        4. 15.4. Summary
    9. A. WCF Template Extensions in Visual Studio
      1. A.1. Summary
    10. B. Case Study
      1. B.1. Case Study: Elevator Control System
        1. B.1.1. Designing the Solution
          1. B.1.1.1. Service Boundaries
          2. B.1.1.2. Service Contract
          3. B.1.1.3. Bindings and Behaviors
          4. B.1.1.4. Program Design
            1. B.1.1.4.1. Elevator Client)
            2. B.1.1.4.2. Control (Service)
        2. B.1.2. Building the Solution
          1. B.1.2.1. Control.cs
          2. B.1.2.2. FormControl.cs
          3. B.1.2.3. ElevatorCar.cs
          4. B.1.2.4. FormElevator.cs
          5. B.1.2.5. Time to Test
          6. B.1.2.6. How it Works
      2. B.2. Summary

    Product information

    • Title: Professional WCF Programming: .NET Development with the Windows® Communication Foundation
    • Author(s):
    • Release date: April 2007
    • Publisher(s): Wrox
    • ISBN: 9780470089842