Home > Store

Windows Communication Foundation 3.5 Unleashed, 2nd Edition

Register your product to gain access to bonus material or receive a coupon.

Windows Communication Foundation 3.5 Unleashed, 2nd Edition

Book

  • This product currently is not for sale.
Not for Sale

eBook

  • Your Price: $42.39
  • List Price: $52.99
  • Includes EPUB and PDF
  • About eBook Formats
  • This eBook includes the following formats, accessible from your Account page after purchase:

    ePub EPUB The open industry format known for its reflowable content and usability on supported mobile devices.

    Adobe Reader PDF The popular standard, used most often with the free Acrobat® Reader® software.

    This eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.

Description

  • Copyright 2009
  • Dimensions: 7 X 9-1/8
  • Pages: 768
  • Edition: 2nd
  • Book
  • ISBN-10: 0-672-33024-5
  • ISBN-13: 978-0-672-33024-7

Windows Communication Foundation (WCF) is Microsoft’s dynamic technology for allowing autonomous software to communicate. Superseding earlier technologies such as COM/DCOM, .NET Remoting, ASP.NET Web Services, and the Web Services Enhancements for .NET, WCF provides a single solution that is designed to always be the best way to exchange data among software entities. It also provides the infrastructure for developing the next generation of Web Services, with support for the WS-* family of specifications, and a new serialization system for enhanced performance. In the 3.5 release, WCF has been expanded to include support for REST, JSON, and Syndication (RSS and Atom) services, further broadening the possibilities for what can be done. For information technology professionals, WCF supplies an impressive array of administration tools that enterprises and software vendors can use to reduce the cost of ownership of their solutions without writing a single line of code. Most important, WCF delivers on the promise of model-driven software development with the new software factory approach, by which one can iteratively design solutions in a modeling language and generate

executables from lower-level class libraries.

Windows Communication Foundation 3.5 Unleashed is designed to be the essential resource for software developers and architects working with WCF. The book guides readers through a conceptual understanding of all the facilities of WCF and provides step-by-step guides to applying the technology to practical problems.

As evangelists at Microsoft for WCF, WF, and CardSpace, Craig McMurtry, Marc Mercuri, Nigel Watling, and Matt Winkler are uniquely positioned to write this book. They had access to the development team and to the product as it was being built. Their work with enterprises and outside software vendors has given them unique insight into how others see the software, how they want to apply it, and the challenges they face in doing so.

--Gives you nearly 100 best practices for programming with WCF

--Provides detailed coverage of how to version services that you will not find anywhere else

--Delves into using WCF together with Windows Workflow Foundation (WF) and Windows CardSpace

--Provides detailed coverage of the new high-performance data contract serializer for .NET

--Walks you through creating secure, reliable, transacted messaging, and how to understand the available options

--Introduces you to federated, claims-based security and shows you how to incorporate SAML and WS-Trust security token services into your architecture

--Provides step-by-step instructions for how to customize every aspect of WCF

--Shows you how to add behaviors, communication channels, message encoders, and transports

--Presents options for implementing publish/subscribe solutions

--Gives clear guidance on peer-to-peer communications with WCF

Downloads

Downloads

Download the example files

Sample Content

Online Sample Chapter

Windows Communication Foundation 3.5: Prerequisites

Sample Pages

Download the sample pages

Table of Contents

Part I Introducing the Windows Communication Foundation

Chapter 1 Prerequisites 9

Partial Types ....................................................................................................9

Generics.........................................................................................................10

Nullable Value Types.....................................................................................13

The Lightweight Transaction Manager.........................................................14

Role Providers ...............................................................................................16

Summary .......................................................................................................18

References......................................................................................................19

Chapter 2 The Fundamentals 21

Background ...................................................................................................21

Enter Services ................................................................................................24

Windows Communication Foundation .......................................................26

The Service Model.........................................................................................28

    A Software Resource.............................................................................34

    Building a Service for Accessing the Resource ....................................36

    Using the Service .................................................................................55

    Hosting the Service in IIS ....................................................................67

    Changing How the Service Communicates ........................................72

Visual Studio 2008 Tool Support ..................................................................75

Summary .......................................................................................................82

References......................................................................................................83

Chapter 3 Data Representation and Durable Services 85

Background ...................................................................................................85

The XmlSerializer and the DataContractSerializer.......................................87

The XML Fetish.............................................................................................91

    Building a Service ................................................................................92

    Building a Client..................................................................................95

    Succumbing to the Urge to Look at XML...........................................95

    The Case for the DataContractSerializer .............................................95

Using the DataContractSerializer .................................................................96

Exception Handling ....................................................................................110

Durable Services ..........................................................................................114

    Why Durable Services? ......................................................................114

    Implementing Durable Services ........................................................115

Summary .....................................................................................................122

References....................................................................................................123

Chapter 4 Sessions, Reliable Sessions, Queues, and Transactions 125

Reliable Sessions..........................................................................................125

Reliable Sessions in Action ................................................................127

Session Management ..................................................................................129

Queued Delivery .........................................................................................130

Enhancements in Windows Vista .....................................................132

Transactions ................................................................................................134

Summary .....................................................................................................143

Part II Introducing the Windows Workflow Foundation

chapter 5 Fundamentals of the Windows Workflow Foundation 147

What Is Windows Workflow Foundation?.................................................147

    What Windows Workflow Foundation Is Not ..................................148

Activities......................................................................................................149

    Out of the Box Activities ...................................................................151

    Creating Custom Activities ...............................................................152

    Communicating with Activities ........................................................160

    Design Behavior.................................................................................167

    Transactions and Compensation.......................................................170

Workflow Models ........................................................................................172

    Sequential Workflows ........................................................................175

    State Machine Workflows..................................................................183

    Custom Root Activities......................................................................184

Workflow Hosting.......................................................................................184

    Hosting the Runtime .........................................................................185

    Runtime Services................................................................................186

    Custom Services.................................................................................196

Rules Engine................................................................................................199

    Rules as Conditions ...........................................................................200

    The ConditionedActivityGroup Activity...........................................202

    Rules as Policy....................................................................................204

Summary .....................................................................................................207

References....................................................................................................207

Chapter 6 Using the Windows Communication Foundation

and the Windows Workflow Foundation Together 209

Consuming Services....................................................................................210

    Calling Services in a Custom Activity...............................................210

    Using the Send Activity (the 3.5 Approach) .....................................214

    Extending the Send Activity..............................................................217

Orchestrating Services.................................................................................219

Exposing Workflows as Services .................................................................220

    Hosting Inside a WCF Service (.NET 3.0)..........................................220

    Exposing a Workflow as a Service (.NET 3.5)....................................226

    Creating a Workflow Service .............................................................233

    Context ..............................................................................................234

    Patterns of Communication..............................................................237

Summary .....................................................................................................248

References....................................................................................................248

Part III Security

Chapter 7 Security Basics 251

Basic Tasks in Securing Communications ..................................................251

Transport Security and Message Security ...................................................252

Using Transport Security.............................................................................253

    Installing Certificates.........................................................................253

    Identifying the Certificate the Server Is to Provide ..........................255

    Configuring the Identity of the Server .............................................256

    Transport Security in Action .............................................................257

Using Message Security...............................................................................263

Impersonation and Authorization..............................................................269

Impersonation.............................................................................................269

Authorization ..............................................................................................272

Reversing the Changes to Windows...........................................................281

    Uninstalling the Certificates .............................................................281

    Removing the SSL Configuration from IIS .......................................282

    Removing the SSL Configuration from HTTP.SYS ............................283

    Restoring the Identity of the Server..................................................283

Summary .....................................................................................................283

References....................................................................................................284

Chapter 8 Windows CardSpace, Information Cards, and the Identity Metasystem 285

The Role of Identity ....................................................................................285

Microsoft Passport and Other Identity Solutions ......................................288

The Laws of Identity ...................................................................................290

The Identity Metasystem ............................................................................291

Information Cards and CardSpace .............................................................297

Managing Information Cards .....................................................................299

Architecture, Protocols, and Security .........................................................306

CardSpace and the Enterprise.....................................................................319

New Features in .NET Framework 3.5 ........................................................322

HTTP Support in .NET Framework 3.5 .......................................................324

Summary .....................................................................................................326

References....................................................................................................327

Chapter 9 Securing Applications with Information Cards 329

Developing for the Identity Metasystem....................................................329

Simple Demonstration of CardSpace..........................................................331

Prerequisites for the CardSpace Samples ....................................................332

    1) Enable Internet Information Services and ASP.NET 2.0 ...............333

    2) Get X.509 Certificates ...................................................................333

    3) Import the Certificates into the Certificate Store.........................334

    4) Update the Hosts File with DNS Entries to Match the Certificates .........334

    5) Internet Information Services Setup .............................................335

    6) Certificate Private Key Access .......................................................335

    7) HTTP Configuration......................................................................336

Adding Information Cards to a WCF Application.....................................337

Adding Information Cards .........................................................................342

Using a Federation Binding ........................................................................347

Catching Exceptions ...................................................................................348

Processing the Issued Token .......................................................................350

Using the Metadata Resolver ......................................................................351

Adding Information Cards to Browser Applications..................................353

Creating a Managed Card...........................................................................364

Building a Simple Security Token Service ..................................................367

Using CardSpace over HTTP .......................................................................370

Summary .....................................................................................................370

References....................................................................................................370

Chapter 10 Advanced Security 371

Prelude.........................................................................................................371

Securing Resources with Claims .................................................................372

    Claims-Based Authorization Versus Role-Based Authorization ........373

    Claims-Based Authorization Versus Access Control Lists .................374

Leveraging Claims-Based Security Using XSI .............................................377

    Authorizing Access to an Intranet Resource Using

    Windows Identity............................................................................377

    Improving the Initial Solution ..........................................................384

    Adding STSs as the Foundation for Federation.................................391

    Reconfiguring the Resource Access Service .......................................405

    Reconfiguring the Client ...................................................................408

    Experiencing the Power of Federated,

Claims-Based Identity with XSI ......................................................411

Claims-Based Security and Federated Security ...........................................412

Summary .....................................................................................................413

References....................................................................................................414

Part IV Integration and Interoperability

Chapter 11 Legacy Integration 417

COM+ Integration.......................................................................................417

    Supported Interfaces ..........................................................................418

    Selecting the Hosting Mode ..............................................................419

Using the COM+ Service Model Configuration Tool.................................419

Exposing a COM+ Component as a Windows

Communication Foundation Web Service...............................................421

    Referencing in the Client ..................................................................426

Calling a Windows Communication Foundation Service from COM ......428

    Building the Service...........................................................................428

    Building the Client ............................................................................431

    Building the VBScript File .................................................................433

    Testing the Solution...........................................................................433

Integrating with MSMQ..............................................................................433

Creating a Windows Communication Foundation Service

That Integrates with MSMQ.....................................................................434

    Creating the Request .........................................................................434

    Creating the Service...........................................................................435

    Creating the Client............................................................................438

Testing................................................................................................442

Summary .....................................................................................................443

Chapter 12 Interoperability 445

Summary .....................................................................................................448

References....................................................................................................448

Part V Extending the Windows Communication Foundation

Chapter 13 Custom Behaviors 451

Extending the Windows Communication Foundation .............................451

Extending the Service Model with Custom Behaviors ..............................452

    Declare What Sort of Behavior You Are Providing ...........................453

    Attach the Custom Behavior to an Operation or Endpoint.............457

    Inform the Windows Communication Foundation of the Custom Behavior ....457

Implementing a Custom Behavior .............................................................458

    Declare the Behavior .........................................................................458

    Attach.................................................................................................458

    Inform................................................................................................459

Implementing Each Type of Custom Behavior..........................................467

    Operation Selector .............................................................................467

    Parameter Inspector...........................................................................469

    Message Formatter .............................................................................471

    Message Inspector..............................................................................473

    Instance Context Provider.................................................................476

    Instance Provider ...............................................................................477

    Operation Invokers............................................................................478

Implementing a WSDL Export Extension ..................................................479

    Implementation Steps .......................................................................480

Custom Behaviors in Action.......................................................................482

Summary .....................................................................................................483

References....................................................................................................483

Chapter 14 Custom Channels 485

Binding Elements........................................................................................485

    Outbound Communication ..............................................................486

    Inbound Communication .................................................................487

Channels Have Shapes................................................................................488

Channels Might Be Required to Support Sessions .....................................490

Matching Contracts to Channels ...............................................................490

Communication State Machines ................................................................492

Building Custom Binding Elements ...........................................................493

    Understand the Starting Point ..........................................................493

    Provide a Custom Binding Element That Supports Outbound Communication ............495

    Amend the Custom Binding Element to Support Inbound Communication.....................502

    Applying a Custom Binding Element Through Configuration ........................................508

Summary .....................................................................................................511

Chapter 15 Custom Transports 513

Transport Channels.....................................................................................513

    Inbound Communication .................................................................514

    Outbound Communication ..............................................................514

Message Encoders........................................................................................514

Completing the Stack .................................................................................514

Implementing a Transport Binding Element and an

Encoder Binding Element.........................................................................516

    The Scenario ......................................................................................516

    The Requirements..............................................................................517

    The TcpListener and the TcpClient Classes.......................................517

Implementing Custom Binding Elements to Support an Arbitrary TCP Protocol ...........520

    The Configuration .............................................................................520

    The Custom Transport Binding Element ..........................................522

    The Channel Listener ........................................................................525

    The Transport Channel .....................................................................528

    The Message Encoder.........................................................................530

    Using the Custom Transport Binding Element.................................532

Summary .....................................................................................................532

References....................................................................................................533

Part VI Special Cases

Chapter 16 Publish/Subscribe Systems 537

Publish/Subscribe Using Callback Contracts..............................................538

Publish/Subscribe Using MSMQ Pragmatic Multicasting ..........................544

Publish/Subscribe Using Streaming ............................................................552

    The Streamed Transfer Mode.............................................................553

    Transmitting a Custom Stream with the Streamed Transfer Mode.......557

    Implementing Publish/Subscribe Using the Streamed Transfer Mode and a Custom Stream .......561

Summary .....................................................................................................565

References....................................................................................................566

Chapter 17 Peer Communication 567

Using Structured Data in Peer-to-Peer Applications ..................................567

Leveraging the Windows Peer-to-Peer Networking

Development Platform .............................................................................568

Understanding Windows Peer-to-Peer Networks .......................................569

Using Peer Channel ....................................................................................569

    Endpoints...........................................................................................569

    Binding ..............................................................................................570

    Address...............................................................................................574

    Contract .............................................................................................574

    Implementation.................................................................................575

Peer Channel in Action ..............................................................................575

    Envisaging the Solution ....................................................................575

    Designing the Data Structures...........................................................579

    Defining the Service Contracts .........................................................581

    Implementing the Service Contracts ................................................584

    Configuring the Endpoints ...............................................................585

    Directing Messages to a Specific Peer................................................587

    Custom Peer Name Resolution..........................................................590

    Seeing Peer Channel Work ................................................................595

Peer Channel and People Near Me.............................................................598

Summary .....................................................................................................598

References....................................................................................................598

Chapter 18 Representational State Transfer and Plain XML Services 599

Representational State Transfer ..................................................................599

REST Services...............................................................................................600

REST Services and Plain XML .....................................................................600

The Virtues and Limitations of REST Services............................................601

Building REST POX Services with the Windows Communication Foundation ........602

    The Address of a REST POX Service Endpoint..................................602

    The Binding of a REST POX Service Endpoint..................................602

    The Contract of a REST POX Service Endpoint ................................603

    Implementation.................................................................................604

    A Sample Application ........................................................................604

RSS and ATOM Syndication in .NET Framework 3.5.................................609

JSON ............................................................................................................615

    A Sample ASP.NET AJAX+JSON Application .....................................616

Summary .....................................................................................................620

References....................................................................................................620

Part VII The Lifecycle of Windows Communication Foundation Applications

Chapter 19 Manageability 623

Instrumentation and Tools .........................................................................624

    The Configuration System and the Configuration Editor................625

    The Service Configuration Editor......................................................627

    Configurable Auditing of Security Events.........................................633

    Message Logging, Activity Tracing, and the Service Trace Viewer .......636

    Performance Counters .......................................................................647

    WMI Provider ....................................................................................649

Completing the Management Facilities .....................................................658

Summary .....................................................................................................659

Chapter 20 Versioning 661

Versioning Nomenclature...........................................................................662

The Universe of Versioning Problems ........................................................662

    Adding a New Operation...................................................................662

    Changing an Operation.....................................................................664

    Deleting an Operation.......................................................................668

    Changing a Binding ..........................................................................669

    Deciding to Retire an Endpoint ........................................................669

    Changing the Address of a Service Endpoint ...................................670

Centralized Lifecycle Management ............................................................670

Summary .....................................................................................................673

References....................................................................................................673

Part VIII Guidance

Chapter 21 Guidance 677

Adopting the Windows Communication Foundation...............................677

Working with Windows Communication Foundation Addresses.............679

Working with Windows Communication Foundation Bindings ..............681

Working with Windows Communication Foundation Contracts.............684

    Working with Structural Contracts ...................................................687

    Working with Behavioral Contracts..................................................689

Working with Windows Communication Foundation Services ................691

    Ensuring Manageability.....................................................................695

Working with Windows Communication Foundation Clients .................699

Working with Large Amounts of Data .......................................................705

Debugging Windows Communication Foundation Applications .............707

Summary .....................................................................................................708

References....................................................................................................709

Updates

Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020