Introduction

Distributed computing has become an integral part of almost all software development. Before the advent of .NET Remoting, DCOM was the preferred method of developing distributed applications on Microsoft platforms. Unfortunately, DCOM is difficult for the average developer to understand and use. Enter .NET Remoting—an object-oriented architecture that facilitates distributed application development using Microsoft .NET. Just as the .NET Framework replaces COM as the preferred way to build components, .NET Remoting replaces DCOM as the preferred way to build distributed applications using the .NET Framework. Furthermore, .NET Remoting provides the basic underpinnings of .NET Web services. Hence, a fundamental understanding of .NET Remoting is crucial as developers shift to more Internet-based distributed application development using the .NET Framework.

This book discusses the .NET Remoting architecture in depth and provides concrete examples in C# that demonstrate how to extend and customize .NET Remoting. We’ll explore the capabilities provided by .NET Remoting and develop examples that clearly demonstrate how to customize key aspects of .NET Remoting. This is where .NET Remoting really shines. Furthermore, the .NET Remoting architecture provides many extensibility hooks that let you use a variety of protocols and configuration options.

When we started working with the .NET Framework, we were pleasantly surprised to learn how easy it is to build distributed applications using .NET Remoting. This is quite a contrast to our experiences with DCOM! Furthermore, we quickly realized the true power of .NET Remoting when we started extending the .NET Remoting infrastructure. In general, we found that .NET Remoting has a logical and cohesive object model that facilitates both simple configuration changes and advanced extensions to the .NET Remoting infrastructure. In addition, .NET Remoting supports open and Internet-based standards such as Web Services and Simple Object Access Protocol (SOAP). It’s not a perfect world though; any new technology usually has its warts. However, we almost always could find reasonable workarounds to the problems we encountered. (We’ll point out these workarounds throughout the book.) We’ve seen our share of new technologies, and we believe .NET Remoting is a strong replacement for its predecessor (DCOM) as well as a powerful tool to support distributed application development in today’s open, Internet-connected environment.

Our Audience

This book is written for anyone who has some experience writing programs using the .NET Framework and wants to learn how to build distributed applications using .NET Remoting. We cover .NET Remoting in detail; no prior knowledge of the subject is required. All examples are in C#, and a working knowledge of C# is recommended; however, we don’t use many advanced features of the language. Although you should have a working familiarity with the .NET Framework and C#, this book will be easily understood by someone with a background in C++, Microsoft Visual Basic .NET, or Java. If you’ve written remote applications using any of these languages, you should have enough knowledge to get the most out of this book.

Organization

We’ve organized this book into the following eight chapters. The first two chapters are conceptual in nature. The remaining chapters of the book focus on advanced concepts and demonstrate how to exploit the extreme extensibility provided by .NET Remoting.

  • Chapter 1: Understanding Distributed Application Development

    This chapter sets the stage by discussing the history of distributed application architecture and technology. The chapter discusses remote procedure calls (RPC), DCOM, Remote Method Invocation (RMI), and SOAP/XML technologies. The goal of the chapter is to address the successes and shortcomings of these past technologies. We then take an in-depth look at how .NET Remoting meets the challenges of both historical and modern distributed application development.

  • Chapter 2: Understanding the .NET Remoting Architecture

    Here we introduce the major architectural components of the .NET Remoting infrastructure. We’ll explore these components in depth in subsequent chapters. This chapter serves as both an introduction and a reference for these .NET Remoting concepts. It provides introductory explanations of each of the major components comprising the .NET Remoting architecture: activation (server activated and client activated), marshal-by-reference, marshal-by-value, leases, channels, messages, and formatters.

  • Chapter 3: Building Distributed Applications with .NET Remoting

    This chapter offers a detailed look at constructing a distributed application using the various stock features provided by .NET Remoting. Here we create a hypothetical job assignment application and use it to demonstrate fundamental .NET Remoting concepts, such as client-activated and server-activated objects. In addition, this application demonstrates how to use .NET Remoting to implement Web Services. This chapter also shows you how to add security to .NET Remoting applications by using the powerful security features of Microsoft Internet Information Services (IIS) and demonstrates how to expose a remote object as a Web Service.

  • Chapter 4: SOAP and Message Flows

    This chapter is a primer on SOAP and examines the messages exchanged between the client applications and server applications developed in Chapter 3. We give you with an extra learning experience by showing you the external artifacts produced and consumed by .NET Remoting.

  • Chapter 5: Messages and Proxies

    In this chapter, we begin by examining messages, which are fundamental to extending and customizing the .NET Remoting infrastructure. The chapter also examines proxies, which act as bridges between local objects and remote objects. Client code makes calls on the proxy object, which in turn invokes methods on the remote object. We show three methods of developing custom proxies and examine how to plug them into the .NET Remoting infrastructure. We use custom proxies to develop two sample applications: one that can dynamically switch from using TCP to HTTP if a connection via TCP isn't possible (for example, because of a firewall), and another that provides load balancing.

  • Chapter 6: Message Sinks and Contexts

    This chapter shows you how to use a .NET Remoting context to enforce rules and behavior for objects executing within the context. This chapter explains what message sink chains are and why they're a major extensibility point in the .NET Remoting framework, providing the foundation upon which the powerful interception capabilities of contexts rest. We also explain each of the different context-related message sinks and show you how to use them.

  • Chapter 7: Channels and Channel Sinks

    Channels are fundamental components of .NET Remoting. This chapter first explains the architecture of the .NET Remoting HttpChannel and its supporting classes so that you gain a better understanding of how to create a custom channel. The chapter then covers extending .NET Remoting with a custom channel type example that uses the file system as a transport mechanism for .NET Remoting messages. Finally, this chapter creates a custom sink that blocks method calls during a user-defined time period.

  • Chapter 8: Serialization Formatters

    The final chapter continues to build on the concepts discussed in the previous chapters and describes serialization formatters in detail. After introducing general serialization concepts, we show you how to extend .NET Remoting by creating a custom serialization formatter and formatter sink.

System Requirements

To build and execute the sample code, you’ll need Microsoft Visual Studio .NET. You’ll also need IIS to run the Web Service and to demonstrate the security techniques discussed in Chapter 3. Although many .NET Remoting features are best demonstrated by using a network with two or more machines, all the sample code in this book will run on a single machine.

Sample Files

The sample files for this book can be found on the Web at http://www.microsoft.com/mspress/books/6172.asp. To get to the companion content for this book once you reach the Web site, click on the Companion Content link in the More Information menu on the right of the Web page. That action loads the companion content page, which includes links for downloading the sample files.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset