You are previewing Microsoft® .NET Distributed Applications: Integrating XML Web Services and .NET Remoting.
O'Reilly logo
Microsoft® .NET Distributed Applications: Integrating XML Web Services and .NET Remoting

Book Description

Make the jump to distributed application programming using the .NET Framework—and introduce a new level of performance, scalability, and security to your network and enterprise applications. Expert .NET developer Matthew MacDonald shares proven techniques for fully exploiting .NET Remoting, XML Web services, and other .NET technologies and integrating them into your real-world solutions. MacDonald digs into key .NET building blocks and architectural issues, explaining which features and designs will best serve your customized distributed application projects—and when to use them. Case studies with full code examples illustrate these practical techniques in action, as well as demonstrating their benefits and tradeoffs.

Table of Contents

  1. Microsoft® .NET Distributed Applications: Integrating XML Web Services and .NET Remoting
    1. Dedication
    2. Acknowledgments
    3. Introduction
      1. Who Should Read This Book
      2. The Focus of This Book
      3. The Three-Part Structure of This Book
        1. Part I: Key Technologies
        2. Part II: Developing an Architecture
        3. Part III: Case Studies
      4. System Requirements
      5. Code Samples
      6. Variable Naming
      7. Feedback
      8. Microsoft Press Support
    4. I. Key Technologies
      1. 1. Understanding Distributed Architecture
        1. What Is a Distributed Application?
        2. Client/Server Architecture
          1. Problems with Client/Server Architecture
            1. The Real Database Bottleneck
            2. Is Deployment a Client/Server Problem?
        3. Distributed Architecture
          1. Advantages of Distributed Architecture
          2. DCOM and the History of Distributed Applications
            1. Distributed Garbage Collection
            2. Complexity
          3. .NET Distributed Technologies
            1. .NET Remoting
            2. XML Web Services
            3. ASP.NET Applications
            4. Combining Distributed Technologies
        4. Summary
      2. 2. .NET Components
        1. What Is a Component?
        2. The Component’s Role in a Distributed System
          1. Service Providers
          2. Information Packages
        3. Dissecting a Sample Component
        4. The IComponent Interface
          1. Using Components at Design Time
          2. Resources and Disposable Classes
            1. Using the Disposable Pattern in a Component-Derived Class
            2. Using the Disposable Pattern in Non-Component Classes
        5. Connection Strings and Configuration Files
          1. Configuration Files in Visual Studio .NET
        6. Deploying an Assembly
          1. Sharing Assemblies
          2. Searching for Private Assemblies
            1. The CodeBase Element
            2. The Probing Element
        7. Versioning Assemblies
          1. Shared Assemblies and the GAC
            1. Step 1: Creating the Key
            2. Step 2: Adding the Key to a Project
            3. Step 3: Installing the Assembly in the GAC
          2. Delayed Signing
        8. Using Configuration Files with Shared Assemblies
          1. Versioning Policies with Strong-Named Assemblies
          2. Code Bases with Shared Assemblies
          3. A Final Word About Assembly Binding
        9. Summary
      3. 3. Disconnected Data: The Universal Language
        1. The Role of ADO.NET in a Distributed System
        2. The ADO.NET Object Family
          1. The Data Objects
          2. Direct Data Source Interaction
          3. Direct Queries and Data Readers
          4. Stored Procedures
          5. Provider-Agnostic ADO.NET Code
          6. Transactions
        3. The DataSet
          1. Creating a DataSet
          2. DataSet Indirection Through Column Mappings
          3. Navigating the DataSet
          4. Relations
            1. Embedding Data in a Control
          5. Updating from a DataSet
          6. Update Issues
            1. The DataSet Is Large
            2. Automatically Generated Commands Perform Poorly
            3. Concurrency Errors Are Common
            4. Update Problems Occur with Relationships
            5. Validation Is Compromised
          7. Handling Errors
        4. XML and Cross-Platform Data Exchange
        5. Summary
      4. 4. .NET Remoting: A More Durable DCOM
        1. The Role of .NET Remoting in a Distributed System
        2. .NET Remoting Fundamentals
          1. Serializable Classes
          2. Remotable Classes
          3. The Remote Component Host
        3. Key .NET Remoting Design Decisions
          1. Activation Modes
          2. Object Lifetime
          3. Server and Client Activation
          4. Communication
        4. A Simple Remoting Server
          1. The Remote Object
          2. The Component Host
          3. The Client Application
          4. A Remotable Component with User Interface
          5. Testing with Visual Studio .NET
          6. Using a Different Formatter
          7. Using Multiple Channels
        5. SingleCall Objects
        6. Singleton Objects
        7. Bidirectional Communication
          1. Using Events
          2. Using Delegates
        8. Configuring Object Lifetime
          1. Modifying Lifetime
          2. Using a Leasing Sponsor
        9. Common Remoting Exceptions
        10. Summary
      5. 5. XML Web Services (RPC the Easy Way)
        1. The Role of XML Web Services in a Distributed System
        2. .NET Remoting vs. XML Web Services
        3. XML Web Service Plumbing
          1. The Role of IIS
          2. Creating a Virtual Directory
          3. The XML Web Service File Format
        4. Creating an XML Web Service
          1. Data Serialization
        5. Testing the XML Web Service
          1. The WSDL Document
        6. Consuming the XML Web Service
          1. Examining the Proxy Class
          2. Using the Proxy Class
          3. Debugging Web Services
        7. ASP.NET Platform Services
          1. SOAP Headers and SOAP Extensions
        8. Publishing an XML Web Service
        9. Cross-Platform XML Web Services
        10. Summary
      6. 6. Threaded Clients (Responsive Interfaces)
        1. What Is Multithreading?
        2. The Role of Threaded Clients in a Distributed System
        3. Threading in .NET
        4. Asynchronous Delegates
          1. Asynchronous Remoting Calls
          2. Asynchronous Web Service Calls
        5. Wait Handles
        6. Callbacks
        7. Asynchronous I/O
        8. Custom Threading
          1. Thread Priorities
          2. Thread Management
          3. Thread Debugging
        9. Locking
          1. Race Conditions
          2. Deadlocks
          3. Advanced Locking with the Monitor Class
            1. Wait, Pulse, and the Provider-Consumer Problem
        10. Custom Threaded Objects
          1. Threading and User Interfaces
          2. Using Callbacks and Locking
          3. Sending Instructions to a Thread
        11. Summary
      7. 7. Thread Pools and Services (Scalable Programming)
        1. The Role of Threading in a Distributed System
        2. Singleton Basics
          1. Tracking Clients
          2. Managing and Cleaning Up Tasks
          3. Ticket Systems
          4. Locking
            1. Advanced Reader-Writer Locking
        3. An XML Web Service Singleton
          1. Thread Pools
        4. Windows Services
          1. Creating a Windows Service
          2. Installing a Windows Service
          3. Debugging a Windows Service
          4. Controlling Windows Services
          5. Using a Windows Service for a Component Host
        5. Summary
      8. 8. Messaging (Lightweight Communication)
        1. The Role of Messaging in a Distributed System
        2. Fire-and-Forget Communication
        3. Introducing Message Queuing
          1. Message Queuing Server
          2. Dependent Client
          3. Independent Client
        4. Message Queuing Basics
          1. Types of Message Queues
            1. Public Queues
            2. Private Queues
            3. Outgoing Queues
            4. Connector Queues
            5. Journal Queues
            6. Dead-Letter Queues
            7. Administration Queues
            8. Report Queues
          2. The Message Queue Service
          3. Configuring Message Queues
          4. The Anatomy of a Message
        5. Manipulating Queues in .NET
          1. Selecting a Queue
          2. Searching for a Queue
          3. Creating a Queue
        6. Sending a Message
          1. Sending Object Messages
          2. Advanced Message Configuration
          3. Receiving a Message
          4. Browsing Messages
          5. Response and Acknowledgement Messages
        7. Message Queues in a Distributed Application
          1. COM+ Queued Components
        8. Summary
      9. 9. COM+ (Component Services)
        1. The Role of COM+ in a Distributed System
        2. COM and Interop
        3. COM+ Registration Basics
          1. Giving Your Assembly a Strong Name
          2. Dynamic Registration
          3. Manual Registration
          4. COM+ and the Declarative Model
          5. COM+ Versioning
          6. Using a COM+ Component
        4. Object Pooling
          1. The Ideal Pooled Component
          2. Pooling and State
          3. A Pooled Component Example
          4. Establishing a Pool
          5. Activation, Deactivation, and Conditional Pooling
          6. Pooling and Data Providers
          7. Object Pooling vs. Connection Pooling
        5. Just-in-Time Activation
          1. JIT Activation and Object Pooling
          2. JIT Activation and .NET
        6. Automatic Transactions
          1. Objects and Transactions
          2. Rolling a Custom Transaction
          3. Isolation Levels
          4. Web Method Transactions
        7. Less Useful COM+ Services
          1. Queued Components
          2. Role-Based Security
          3. Synchronization
          4. Loosely Coupled Events
          5. Object Construction String
          6. SOAP Services (Only in COM+ 1.5)
        8. Summary
    5. II. Developing an Architecture
      1. 10. Enterprise Application Modeling
        1. Key Considerations for Distributed Components
          1. Cross-Process and Cross-Computer Communication
          2. The Question of State
          3. Are Remote Objects Really Objects?
        2. Performance vs. Scalability
          1. The Lessons Learned
        3. Designing in Tiers
          1. Business Objects
          2. Rules
            1. User Interface Rules
            2. Data Layer Rules
        4. Distributed Design Patterns
          1. Interfaces
          2. Factories
          3. Facades
          4. Facades and Interception
          5. Facades and XML Web Services
          6. Facades and Transactions
        5. Choosing the Right .NET Technology
          1. Internal and External Systems
          2. Hybrid Internal/External Systems
          3. The Common Back End
          4. Partially Disconnected Systems
          5. Upgrading from COM
        6. Physical Architecture
          1. Scaling
          2. Load Balancing
        7. Summary
      2. 11. Advanced Remoting Techniques
        1. Developing with .NET Remoting in Mind
          1. ByRef and ByVal Arguments
          2. Exception Propagation
          3. Static Members
          4. Private Methods
          5. Public Members
          6. Versioning
            1. Versioning with Server-Activated Objects
            2. Versioning with Client-Activated Objects
            3. Versioning with Serializable Objects
          7. Interface-Based Programming
            1. The CustomerInterfaces Assembly
            2. The Remote Object
            3. The Component Host
            4. The Client
          8. Problems with Interface-Based Remoting
            1. Stubs
        2. .NET Remoting and XML Web Services Revisited
          1. Soapsuds and WSDL Description
          2. ASP.NET Hosting
        3. Programmatic Registration
        4. Dynamic Publication
          1. Recording Connection Information with an XML Web Service
          2. A Closer Look at ObjRef
        5. Summary
      3. 12. Optimizing the Data Tier
        1. Connection Pooling
          1. Connections and Application Domains
          2. Testing Connection Pooling
        2. Developing a Data Transfer Plan
          1. Batch Updates
        3. Caching
          1. Output (Response) Caching
          2. Considerations for Output Caching
          3. Data Caching
            1. Absolute Expiration
            2. Sliding Expiration
            3. Retrieving a Cached Item
          4. Determining a Caching Strategy
        4. Optimizing the Database
          1. Stored Procedures
          2. Indexes
          3. Profiling
          4. Partition Large Data Tables
          5. Placing Code in the Data Tier
          6. Normalizing
        5. Summary
      4. 13. Implementing Security
        1. Authentication and Authorization
        2. Windows Authentication
          1. IIS Authentication Settings
          2. Setting Authentication Information with an XML Web Service Client
          3. Setting Authentication Information with a .NET Remoting Client
          4. Available User Information
          5. Impersonation
        3. Custom Role-Based Authentication
          1. Ticket Systems
          2. Passing Tickets Automatically
        4. Encryption
        5. SSL
          1. SSL and Certificates
          2. Communicating with SSL
        6. The .NET Encryption Classes
          1. Selective Asymmetric Encryption
          2. Selective Symmetric Encryption
          3. Selective Encryption with .NET Remoting
          4. Using Custom Classes to Wrap Encryption
          5. Using .NET Serialization to Encrypt Classes
          6. Code Access Security
          7. Security and the Stack Walk
          8. Security Demands
          9. Security Assert, Deny, and PermitOnly
        7. Summary
      5. 14. Monitoring, Logging, and Profiling
        1. Server-Side Logging
          1. Logging with Facades and Reflection
          2. The Windows Event Log
            1. Writing Log Entries
            2. Retrieving Log Entries
            3. Handling Log Events
          3. Direct Mail Notification
        2. Client-Side Logging
          1. Using Tracing
            1. Trace Listeners
            2. Trace Switches
          2. Catching Unhandled Errors
        3. Profiling with Performance Counters
          1. Essential Performance Counters
          2. Custom Performance Counters
        4. Summary
      6. 15. Deployment Strategies
        1. Traditional Deployment Problems and .NET Solutions
        2. The Application Launcher
          1. Security Holes in the Upgrade XML Web Service
          2. Other Enhancements to the Application Launcher
        3. The Application Browser
          1. The Application Browser XML Web Service
          2. The Application Browser Modules
          3. The Application Browser
          4. Code Access Security
          5. Improving Communication in the Application Browser
          6. A More Dynamic Application Browser
        4. Summary
    6. III. Case Studies
      1. 16. Invoicer.NET Traveling Sales
        1. Defining the Problem
          1. Key Analysis
          2. Evaluating Different Paths
        2. Defining the Solution
        3. The Data Layer
          1. Stored Procedures
          2. The Excel Spreadsheet
          3. The Data Component
          4. The CustomersDB Class
          5. The OrdersDB Class
          6. The InvoicerTables Class
          7. The ExcelTranslator Class
        4. The Back-End OrderProcessor Service
        5. The Web Front End
        6. The XML Web Service Layer
        7. Migration Strategies
          1. Adding Security
          2. Adding Early Validation
          3. Using Unique Filenames
          4. Excel Headaches and a Dedicated Windows Client
        8. Summary
      2. 17. Transact.NET Order Fulfillment
        1. Defining the Problem
          1. Key Analysis
        2. Defining the Solution
        3. The Data Layer
          1. Stored Procedures
          2. The Data Component
          3. The ProductDB Class
          4. The OrderDB Class
          5. The TransactTables Class
        4. The Order Submission XML Web Service
        5. The Order Client
        6. The Internal OrderFill Client
          1. The Queue Monitor
        7. Future Directions
          1. Adding Security
          2. Adding Confirmation GUIDs
          3. Supporting Multiple Order-Filling Clients
        8. Summary
      3. 18. SuperCompute.NET Work Requests
        1. Defining the Problem
          1. Key Analysis
        2. Defining the Solution
        3. The Data Layer
          1. Stored Procedures
          2. The Data Component
          3. The UserDB Class
          4. The SessionDB Class
          5. The TaskDB Class
          6. The SuperComputeTables Class
        4. The Render Web Service
          1. RenderService Authentication
          2. RenderService Functionality
        5. The Client
        6. The Task Processor
          1. The TaskProcessor Component
          2. The Task Processor Front End
          3. Downloading a Rendered File
        7. Future Directions
          1. Adding Ticket Caching
          2. Enhanced Client Cleanup
          3. Adding Message Queuing
          4. Adding Load Balancing
        8. Summary
      4. 19. Microsoft Case Studies
        1. The IBuySpy Storefront
        2. The IBuySpy Portal
        3. Duwamish 7
        4. .NET Pet Shop
        5. Fitch & Mather Stocks 7
        6. Nile Books
        7. ColdStorage
        8. Jaggle
        9. Favorites Service
    7. A. About the Author
      1. Matthew MacDonald