The only book to clearly explain what .NET Enterprise Services are and how to use them to build effective scaleable business applications
° The first book in English to cover .NET Enterprise Services, a key new technology from Microsoft
° Learn how to build scalable business applications quickly and more easily
° Discover how to integrate .NET components with existing COM-based applications
° Author is a respected and visible member of the .NET Development community.
"For anyone involved in the .NET community, it's hard to not have heard of Christian Nagel. Christian is a true heavyweight of .NET in general, and Enterprise Services in particular. By taking a relatively trivial application and architecting it in a way that would allow it to scale without any rework, users will find that using the techniques employed in this book will be of benefit to virtually any company that is running distributed or enterprise applications."
William G. Ryan, Microsoft MVP, Senior Software Developer, TiBA Soutions, LLC
"Whether you are a seasoned architect or a new developer, distributed application development can be difficult, since it covers such a wide range of complex technologies. Until now there was precious little in the way of guidancelet alone a consolidated reference. Christian has provided that reference and moregoing from the individual technologies to the big picture on how to architect and develop scalable distributed applications. Technical goodness through and through!"
Clayton Burt, Managing Partner, Onzo, LLC
"Making the transition to distributed application architecture introduces many issues in security and deployment and requires a new way of thinking about events, transactions, and messaging. This book shows developers and architects alike how to use .NET Enterprise Services to create robust, secure, and maintainable applications in a distributed environment. This book is an excellent guide to the sometimes overwhelming field of .NET Enterprise Services."
Brian Davis, Director of Software Development, InfoPro Group, Inc., Co-Creator, KnowDotNet.com
Enterprise Services with the .NET Framework is the only book that experienced .NET developers need to learn how to write distributed, service-oriented applications. Filled with clear examples in C# (with Visual Basic .NET examples available on the Web), this book will quickly get you up to speed on building distributed applications with serviced components. You'll also learn about Indigo, Microsoft's next-generation technology for building distributed applications, and how it compares to Enterprise Services.
Microsoft Regional Director, MVP, and veteran author Christian Nagel introduces and clearly explains the four major services included in Enterprise Services: Automatic Transactions, Queued Components, Loosely Coupled Events, and Role-Based Security. From his in-depth coverage, you'll learn
How to create a serviced component, how serviced objects are activated, and how to use the different kinds of object contexts
How to manage concurrency and synchronization for serviced components to achieve optimal performance and data integrity
How to integrate COM components with the .NET Framework
How to use serviced components over a network with DCOM, SOAP Services, and ASP.NET Web services
How to use .NET Enterprise Services transactions to achieve Atomicity, Consistency, Isolation, and Durability
How to build a compensating resource manager to allow your own resources to participate in Enterprise Services transactions
How to maintain application state in a client application, in a serviced component, in shared properties, or in a database
How to create and use Loosely Coupled Events using COM+
How to secure a distributed solution using authorization, authentication, impersonation, and confidentiality
How to deploy and configure Enterprise Services applications
© Copyright Pearson Education. All rights reserved.
Download the Sample
Chapter related to this title.
About the Author
1. Introducing .NET Enterprise Services.
Logical Tiers and Physical Systems
The History of Application Services
COM and .NET
Microsoft Transaction Server
.NET Enterprise Services
Applications and Components
Loosely Coupled Events
New Features with COM+ 1.5
2. Object Activation and Contexts.
.NET Remoting Contexts
Contexts with Serviced Components
Mixing .NET and COM+ Contexts
Creating a Serviced Component
Signing the Assembly
Global Assembly Cache
Just-in-Time Activation (JITA)
JITA and Object Disposing
More Synchronization Options
.NET Enterprise Services Synchronization
Selecting the Synchronization Option
Services Without Components
Using a New Activity
Starting a New Context
4. COM Interop.
.NET Clients Without COM Interop
COM Callable Wrappers and Runtime Callable Wrappers
Default COM Configuration
Generated Type Library
COM Interface Types
Private and Shared Assemblies
COM Registry Entries
COM and .NET Requirements
Visual Basic 6 Clients
C++ COM Clients
Calling a COM Object
Runtime Callable Wrapper
DCOM Transport Protocols
Creating an Application Proxy
Installing the Application Proxy
Creating a DCOM Client Application
.NET Remoting Overview
Creating a Serviced Component Using .NET Remoting
Configuring the Server Application
Creating a .NET Remoting Client
Disadvantages of SOAP Services
Implementing a Web Service with ASP.NET
Creating a Proxy
6. Data Access.
Calling Stored Procedures
7. Transaction Services.
Automatic Transaction Example
Setting the Transactional Vote
Transactions with Services Without Components
Transactions Support with ASP.NET
Potential Transaction Isolation Problems
Transaction Isolation Levels
Monitoring the DTC
Transactions with .NET 2.0
8. Compensating Resource Management.
CRM Application Classes
CRM Application Example
9. State Management.
Stateful or Stateless Components
Databases and Files
Shared Property Manager
Shared Property Group Manager
Shared Property Group
SPM State Characteristics
ASP.NET State Management
Accessing ASP.NET State from Within Serviced Components
ASP.NET State Characteristics
Client State Management
.NET Remoting Call Contexts
10. Queued Components.
Message Queuing Server
Message Queuing Client
Message Queuing Features
Creating a Queued Component
The CourseControl Class
11. Loosely Coupled Events.
Using LCEs Across the Network
Event Class Proxies
LCE and Queued Components
Event Classes as Queued Components
Subscribers as Queued Components
Internet Information Server
ASP.NET Web Applications
ASP.NET Web Services
Enabling Access Checks
Defining Role Access
Checking Roles Within Methods
Authentication Levels and Impersonation
Reading the Identity of the Caller
Enterprise Services and .NET Remoting
13. Deployment and Configuration.
Creating a Custom Installer
Creating an Installation Package
Configuring the Application as a Service
14. The Future of Distributed Applications.
Web Services Specifications
Moving from Enterprise Services to Indigo
15. Case Study.
Use Case-Course Management
The CourseManagement Database
CourseManager-Windows Forms Client
This book is the result of many years of work. I started developing distributed business solutions on Microsoft platforms when the Microsoft Transaction Server was released in 1996. Since then I have worked on several projects helping customers with the design and implementation of business solutions. I have been asked to do many thingssuch as integrating existing technologies and creating custom frameworks that can be extended in a flexible way for certain applications.
When Microsoft showed a preview version of .NET at the Professional Developers Conference in 2000 I was really excited about this new technology. Since then I've co-authored many .NET books, including Professional C# (Wrox 2004), Beginning Visual C# (Wrox 2002), C# Web Services (Wrox 2001), and Prof .NET Network Programming (Apress 2004).
Many of the things I've learned over the years have been combined to form this book.
Why would you use .NET Enterprise Services? .NET Enterprise Services is the .NET way to use COM+ Services, a technology that is part of the operating system and is used by companies throughout the world. .NET Enterprise Services extends COM+ Services with .NET behavior to make use of this technology. Regardless of whether you use Windows Forms or ASP.NET to create business solutions that have front-end applications, on the server side common features are needed for building scalable and interoperable solutions.
With .NET Enterprise Services you get features such as resource management with object pooling and thread pooling, automatic and distributed transactions, a lose connection between the server and the client for performing callbacks, queued components that can be used as an abstraction layer for message queuing, role-based security, and much more.
This book isn't an introduction to .NET programming; there are many other books that fill that role. With this book I assume you already have some knowledge of .NET programming.
Although COM+ is the base of .NET Enterprise Services, COM knowledge is not a requirement for understanding this book or for creating .NET Enterprise Services solutions. However, if you do have COM knowledge and want to integrate existing COM components with .NET applications, this book will provide you with great information.
This book contains 15 chapters that show the services offered by .NET Enterprise Services. First, this book introduces you to all these services. It then teaches you the fundamentals of Enterprise Services by stepping into the core technologies. Finally, it describes all the services in separate chapters. With each chapter you get an architectural viewpoint of the reasons and usage scenarios of the services and then you dig into the code. After an overview of the technology you will find many code examples, so you not only learn about the features, you also learn how to use them. Throughout the book are tips and tricks that help reveal the best aspects of this technology. The final chapter presents a case study in which different services are combined so you can see them interact in a real-world scenario.
Chapter 1, "Introducing .NET Enterprise Services," provides an overview of the technologies that are related to Enterprise Services. Here you get a clear picture of what technologies you can and should use in your business solutions. A background of the evolution from MTS to COM+ and .NET Enterprise Services helps you better understand these technologies.
Chapter 2, "Object Activation and Context," covers the base technology of COM+ and .NET Enterprise Services. It provides information about how the services are made possible. You also learn about the interception mechanisms. The first serviced components are built in this chapter, and you see contexts and object activation in action.
Chapter 3, "Concurrency," teaches you the basic knowledge of running threads concurrently and how to avoid race conditions and deadlocks. After discussing COM apartment models, the chapter explains COM+ activities. Services Without Componentsa new feature with COM+ 1.5plays an important role in this chapter.
Chapter 4, "COM Interop," is ideal for those who have existing COM components that should be integrated with new .NET serviced components in their business solution. Here you learn the integration of COM and .NET technologies.
Chapter 5, "Networking," provides information about accessing the .NET Enterprise Services application using DCOM, .NET Remoting, and Web services. You will also learn which technologies are preferred based on application context.
Chapter 6, "Data Access," teaches you how to access databases with ADO.NET. This chapter not only provides an introduction to ADO.NET, it also gives you some tips and tricks on how to best use ADO.NET in a distributed environment.
Chapter 7, "Transactions," explains the ACID properties that describe a transaction (Atomicity, Consistency, Isolation, and Durability), shows you how to program transactions with ADO.NET, and describes all the transaction options and settings in .NET Enterprise Services. You'll learn about the functionality of the different features, and how to determine how your components should be configured from a transactional viewpoint.
Chapter 8, "Compensating Resource Manager," demonstrates how you can create your own resource manager that participates with the transactions of the distributed transaction coordinator (DTC).
Chapter 9, "State Management"should you create stateful or stateless components? Where should you put the stateon the client or on the server? This chapter points out the different options of the state with various application models.
Chapter 10, "Queued Components," is an often overlooked technology with distributed solutions. In this chapter you'll read about the functionality of message queuing, and the abstraction layer Queued Components that makes it possible to invoke methods of components that are automatic-ally converted to messages and thus can be used in a disconnected environment.
Chapter 11, "Loosely Coupled Events," compares COM and .NET event models to the event model that is offered with .NET Enterprise Services. With LCE an interception model is used when the component does not directly interact with the client. You will read about how loosely coupled events can be used in different scenarios, and how filters can be defined.
Chapter 12, "Security," explains authorization, authentication, impersonation, and confidentiality concepts of a distributed solution in regard to Enterprise Services applications. Because many products interact with .NET Enterprise Services in a business solution, this chapter discusses security issues of SQL Server, ASP.NET Web applications, Web services, and .NET Remoting along with the security issues of .NET Enterprise Services itself.
Chapter 13, "Deployment and Configuration," covers how to install and configure server applications and client applications with the proxies that access the serviced components.
Chapter 14, "The Future of Distributed Applications," provides information about upcoming technologies, and how you can prepare for them in your applications today.
Chapter 15, "Case Study" is a roundup of the technologies covered in the previous chapters. It combines their features to build an application that includes technologies from the client side to the database so you can see many .NET Enterprise Services features in collaboration.
If you have feedback about this book or you want training and/or consulting with .NET Enterprise Services and Web services, you can contact me through my website: http://www.christiannagel.com.
Feedback is always welcome!
© Copyright Pearson Education. All rights reserved.
CREATING INFRASTRUCTURE-LEVEL CODE TO support complex transactional systems (including distributed transactions and even the support for compensating actions instead of simple rollback operations), fine-grained authentication capabilities, a framework for role-based authentication, the transparent support for asynchronous queuing-based interactions, an adaptive threading model, a complete process and control model, and an instrumented hosting environment which supports different levels of indirection (in-process, local, remote) is arguably one of the greatest, most fun, and most challenging things a developer can do. At the same time, it is the very task our customers don't want to see us spending time on. After all, it can hardly be said that developing these features will advance the paying customer's business in any way. One could even say that the manual implementation of all these features would fail a reasonable build-versus-buy analysis. They should be a commodity and not something you would have to create manually.
This is where Enterprise Services enters the game. Itespecially the underlying COM+ frameworkis an integral part of Microsoft's application server offering, which provides these features. Yes, Microsoft hasn't been talking too much about their operating system as an application server, but this is essentially what the server editions of Windows have become. We are not talking about file or print servers anymore. Today, Windows systems (and this even includes Windows CE up to a certain point) come with built-in components which would be calledand separately sold asan application server were they developed on other platforms.
On the Windows platform, however, these application server components do not always live on the main stage. As they are essentially free modules of Windows systems, no conscious decision of whether or not they should be bought has to be made. They are just there. They are the ultimate commodity.
Unfortunately, I have noticed in the past years that only a few developers have spent time looking into these commoditized services as a base for their application's architecture. Most engineers still tend to solve the basic problems outlined above on their own. That would not necessarily be a bad thing, apart from the sad fact that it is usually very easy to get, for example, 80 percent of a transaction management system almost right. In my experience, at least, it's only the final 20 percent which can get incredibly harder. And for transactional systems, only the full 100 percent really counts. (Or would you like to go to your customer and explain that, in certain cases, the accounting system you have built is losing data even though it tells the user that everything is okay? I fear this would certainly not be a pleasant experience.) The same tends to be true for security, scalability, queuing, and instrumentation: Only the full 100 percent counts as these are essential infrastructure services.
But it might not be only selective knowledgeomitting the knowledge about COM+ or Enterprise Servicesthat leads to the reimplementation of infrastructure code like this. Quite the contrary might be true. If you are similar to me, you might like to approach new technology in a rather hands-down way1: Go online, get some samples, run them, change them, learn how the system reacts, dig deeper, learn, and understand. Unfortunately, Enterprise Services doesn't necessarily lead itself to this way of development. When you create your first component marked with [assembly: ApplicationActivation(ActivationOption.Server)], you will immediately notice that there is more going on under the hood than you might have thought in the first place.
Please let me speak a word of caution in this regard: The Enterprise Services framework provides very simple access to implementations of a very complex nature. From time to time, you will therefore need to deal with the complexities of large-scale distributed applications. But that's hardly the fault of the Enterprise Services framework. Instead, it is simply caused by the fact that the creation of large-scale distributed applications itself is a very complex and difficult topic. The combination of Enterprise Service's ease-of-use and its relatively high level of abstraction of a very complex topic leads to a situation in which you will have to know more than you believed you would at first glance. This is why books like this one are so important.
I have known Christian since the early days of .NET. In fact, the days were so early that .NET was still called NGWS (Next Generation of Windows Services) and C# was still codenamed Cool. Christian has always been a tremendous author, a remarkable trainer, a smart consultant with real-world experience, a good friend, and a great colleague. There are only a few people in this world who can explain Enterprise Services in reasonable depthChristian is one of them. It is a true pleasure to see that he found the time to write this book.
1 This might be the Tim Taylor way of developing: "Real men don't need instructions."
© Copyright Pearson Education. All rights reserved.
Download the Index
file related to this title.