Siêu thị PDFTải ngay đi em, trời tối mất

Thư viện tri thức trực tuyến

Kho tài liệu với 50,000+ tài liệu học thuật

© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

Pro Scalable .NET 2.0 application designs
PREMIUM
Số trang
537
Kích thước
9.6 MB
Định dạng
PDF
Lượt xem
1585

Pro Scalable .NET 2.0 application designs

Nội dung xem thử

Mô tả chi tiết

Joachim Rossberg

Rickard Redler

Pro Scalable .NET 2.0

Application Designs

5416chFM.qxd 9/21/05 5:35 PM Page i

Pro Scalable .NET 2.0 Application Designs

Copyright © 2006 by Joachim Rossberg and Rickard Redler

All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means,

electronic or mechanical, including photocopying, recording, or by any information storage or retrieval

system, without the prior written permission of the copyright owner and the publisher.

ISBN: 1-59059-541-6

Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1

Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence

of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark

owner, with no intention of infringement of the trademark.

Lead Editor: Ewan Buckingham

Technical Reviewer: Jason Lefebvre

Editorial Board: Steve Anglin, Dan Appleman, Ewan Buckingham, Gary Cornell, Tony Davis, Jason Gilmore,

Jonathan Hassell, Chris Mills, Dominic Shakeshaft, Jim Sumser

Project Manager: Beckie Stones

Copy Edit Manager: Nicole LeClerc

Copy Editor: Julie M. Smith

Assistant Production Director: Kari Brooks-Copony

Production Editor: Lori Bring

Compositor and Artist: Kinetic Publishing Services, LLC

Proofreader: Linda Seifert

Indexer: Broccoli Information Management

Interior Designer: Van Winkle Design Group

Cover Designer: Kurt Krames

Manufacturing Director: Tom Debolski

Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor,

New York, NY 10013. Phone 1-800-SPRINGER, fax 201-348-4505, e-mail [email protected], or

visit http://www.springeronline.com.

For information on translations, please contact Apress directly at 2560 Ninth Street, Suite 219, Berkeley,

CA 94710. Phone 510-549-5930, fax 510-549-5939, e-mail [email protected], or visit http://www.apress.com.

The information in this book is distributed on an “as is” basis, without warranty. Although every precau￾tion has been taken in the preparation of this work, neither the author(s) nor Apress shall have any

liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly

or indirectly by the information contained in this work.

The source code for this book is available to readers at http://www.apress.com in the Source Code section.

5416chFM.qxd 9/21/05 5:35 PM Page ii

To Karin

Opus, you will always be with me in my heart

Gaston, this one is for you as well

—Joachim Rossberg

To Jenny & Leah

—Rickard Redler

5416chFM.qxd 9/21/05 5:35 PM Page iii

5416chFM.qxd 9/21/05 5:35 PM Page iv

Contents at a Glance

Foreword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv

About the Authors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii

About the Technical Reviewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix

Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi

Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii

■CHAPTER 1 Introduction to Enterprise Application Design . . . . . . . . . . . . . . . . . . . . 1

■CHAPTER 2 Windows Server System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

■CHAPTER 3 Cluster Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

■CHAPTER 4 An Overview of the Windows Server Family. . . . . . . . . . . . . . . . . . . . . 97

■CHAPTER 5 The Enterprise Application Architecture . . . . . . . . . . . . . . . . . . . . . . . 149

■CHAPTER 6 Web Services Design and Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207

■CHAPTER 7 Service Oriented Architecture (SOA) . . . . . . . . . . . . . . . . . . . . . . . . . . . 277

■CHAPTER 8 Internet Information Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307

■CHAPTER 9 Data Storage Design and SQL Server . . . . . . . . . . . . . . . . . . . . . . . . . . 345

■CHAPTER 10 An Example Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391

■APPENDIX A Test Equipment At Dell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473

■APPENDIX B Coding Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475

■INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489

v

5416chFM.qxd 9/21/05 5:35 PM Page v

5416chFM.qxd 9/21/05 5:35 PM Page vi

Contents

Foreword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv

About the Authors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii

About the Technical Reviewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix

Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi

Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii

■CHAPTER 1 Introduction to Enterprise Application Design . . . . . . . . . . . . . 1

In the Beginning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

Enterprises Today . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

Types of Integration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

Integration with Legacy Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

Integration with Actors Outside the Enterprise . . . . . . . . . . . . . . . . . . . 8

SOA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

Content Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

The Anatomy of a Content Management System (CMS) . . . . . . . . . . 13

Problems with Content Management Today . . . . . . . . . . . . . . . . . . . . 14

The Content Creators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

The Unified Modeling Language (UML) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

Activity Diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

Use Cases and Use Case Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

Sequence Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

Class Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

UML and SOA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

Object Role Modeling (ORM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

Why Use ORM?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

ORM and SOA. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

■CHAPTER 2 Windows Server System. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

Microsoft Operating Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

Windows 2000 Server Family . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

Windows Server 2003 Family . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

Windows Server System. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

vii

5416chFM.qxd 9/21/05 5:35 PM Page vii

cafac74dd2d083cbec0906b66fcd56b1

■CHAPTER 3 Cluster Techniques. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

What Clustering Does . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

Availability. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

Scalability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

Different Types of Clusters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

Network Load Balancing (NLB) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

Microsoft Cluster Service (MSCS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

Combining the Two . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

When to Use What . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66

Network Load Balancing Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66

Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67

Scalability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

Availability. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

Manageability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70

Pros and Cons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70

MS Cluster Service Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71

Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72

Availability. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73

Manageability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73

Pros and Cons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73

Application Center Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74

Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75

Cluster Services and Load Balancing. . . . . . . . . . . . . . . . . . . . . . . . . . 76

Synchronization and Deployment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82

Monitoring. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83

Use of Application Center . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89

Maintaining Session State in a Clustered Solution. . . . . . . . . . . . . . . 94

Pros and Cons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96

■CHAPTER 4 An Overview of the Windows Server Family . . . . . . . . . . . . . . 97

Windows Server Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97

Scalability, Availability, and Reliability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112

Performance Comparisons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133

Security in Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148

viii ■CONTENTS

5416chFM.qxd 9/21/05 5:35 PM Page viii

■CHAPTER 5 The Enterprise Application Architecture . . . . . . . . . . . . . . . . . 149

What Is an Enterprise Application?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149

Internet Information Services. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151

COM+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151

Microsoft Message Queuing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152

Windows Server 2003. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153

.NET Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153

The Enterprise Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156

Enterprise Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157

OOP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158

Abstraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158

Encapsulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158

Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158

Polymorphism. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159

Design Patterns and Layers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159

Creational Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160

Structural Patterns. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161

Behavioral Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163

The Enterprise Application and Its Layers . . . . . . . . . . . . . . . . . . . . . 166

The Enterprise Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170

Caching Application Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170

Configuration Application Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171

Data Access Application Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171

Cryptography Application Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171

Exception Handling Application Block . . . . . . . . . . . . . . . . . . . . . . . . 171

Logging and Instrumentation Application Block . . . . . . . . . . . . . . . 171

Security Application Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171

Coding Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172

Comments. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172

Memory Management. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172

Data Access Strategy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173

Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174

.NET Enterprise Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175

Transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176

Deployment. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177

Versioning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180

Serviced Components. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181

■CONTENTS ix

5416chFM.qxd 9/21/05 5:35 PM Page ix

Windows/Web Forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184

Windows Forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185

Web Forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187

Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188

.NET Remoting in the Enterprise World . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188

The .NET Remoting Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189

Choosing .NET Remoting Objects or Web Services . . . . . . . . . . . . . 190

Content Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191

Analyze the Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191

Some of the Content Management Tools on the Market. . . . . . . . . 194

Content Management Systems Wrap-Up. . . . . . . . . . . . . . . . . . . . . . 197

Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198

Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199

Input Validation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202

Testing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203

Rule 1: Testing Should Begin in the Planning Phase . . . . . . . . . . . . 203

Rule 2: Test Against Measurable Criteria . . . . . . . . . . . . . . . . . . . . . . 203

Rule 3: Testing Is for Experienced Developers—

Not for Rookies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203

Rule 4: The Test Environment Should Be Identical to the

Real Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203

Rule 5: Security Concerns Will Continue to Increase . . . . . . . . . . . . 204

Rule 6: Approach Automated Testing Tools with Caution . . . . . . . . 204

Rule 7: Complex Today—Even Worse Tomorrow . . . . . . . . . . . . . . . 204

Testing Tools. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206

■CHAPTER 6 Web Services Design and Practice . . . . . . . . . . . . . . . . . . . . . . . 207

Web Services and Distributed Applications. . . . . . . . . . . . . . . . . . . . . . . . . 208

What Can You Do with Web Services? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209

Deciding When to Use Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209

When to Use Web Services. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210

When Not to Use Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210

Interoperability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211

Business-to-Business Integration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212

Software Reuse with Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212

The Building Blocks of Web Services. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213

XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213

XSD. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214

SOAP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216

x ■CONTENTS

5416chFM.qxd 9/21/05 5:35 PM Page x

SOAP over HTTP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222

SOAP over HTTPS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223

RPC and SOAP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224

Error Messages in SOAP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225

WSDL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225

UDDI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226

Transactions and Web Services. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227

Putting It All Together . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227

Using SOAP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230

Tracing SOAP Messages. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230

The Web Service Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230

Soap Faults . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235

Extending SOAP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237

SOAP Headers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238

SOAP Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239

Using SOAP Extensions to Implement Authorization for

a Web Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240

Handling Binary Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242

Handling Attachments. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243

WS-I Specifications and Support for Security. . . . . . . . . . . . . . . . . . 243

Web Services Enhancements (WSE) SDK . . . . . . . . . . . . . . . . . . . . . 245

WSE and Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249

WSE and Binary Attachments in DIME Format . . . . . . . . . . . . . . . . . 259

WSE and Binary Attachments with MTOM. . . . . . . . . . . . . . . . . . . . . 266

Web Services and Transactions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267

Scaling Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270

Caching Web Services Results and Other Performance

Tips and Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270

.NET Remoting vs. Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275

■CHAPTER 7 Service Oriented Architecture (SOA). . . . . . . . . . . . . . . . . . . . . . 277

Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277

What Is a Service?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278

What Is This Thing Called SOA? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279

Why Use SOA? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279

Services and SOA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280

The Four Tenets of Don Box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280

Sprott and Wilkes SOA Characteristics. . . . . . . . . . . . . . . . . . . . . . . . 282

Sundblad and Sundblad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282

■CONTENTS xi

5416chFM.qxd 9/21/05 5:35 PM Page xi

Four Types of Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285

Architecture of a Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286

Entity Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287

Presentation Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289

Transactions in SOA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290

Summary So Far . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292

Component-Based Application Design vs. Service Design. . . . . . . . . . . . 292

Scalability Issues in an SOA. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301

Other Issues to Consider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301

Windows Communication Foundation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302

What Is Windows Communication Foundation? . . . . . . . . . . . . . . . . 303

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305

■CHAPTER 8 Internet Information Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307

Internet Information Services 5.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307

Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307

Performance and Scalability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315

Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321

Internet Information Services 6.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325

Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325

Performance and Scalability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330

Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331

Integrating ASP.NET with IIS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338

ASP.NET 2.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341

Performance Monitoring. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343

■CHAPTER 9 Data Storage Design and SQL Server. . . . . . . . . . . . . . . . . . . . . 345

Three Storage Technologies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346

Storage Area Networks (SANs) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346

Network-Attached Storage (NAS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347

Direct-Attached Storage (DAS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347

Logical Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348

Choosing Your Storage Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350

Introduction to SQL Server. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353

SQL Server Editions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354

SQL Server 2000 Architecture. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359

SQL Server 2005 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389

xii ■CONTENTS

5416chFM.qxd 9/21/05 5:35 PM Page xii

■CHAPTER 10 An Example Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391

Application Assumptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391

Application Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392

How the Application Will Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392

UML Modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393

Activity Diagrams. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393

Actors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396

Use Cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396

Sequence Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397

Class Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400

Designing the Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403

Object Role Modeling (ORM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404

The Logical Database Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406

The Physical Database Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408

Indexing the Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408

Choosing the Application Platform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409

The Chosen Platform. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410

The Test Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 411

Web Server Clusters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412

What We Did to Secure and Tune Our System . . . . . . . . . . . . . . . . . 412

Application Layer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426

Database. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427

The Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 428

Checking That All Requirements Are Covered. . . . . . . . . . . . . . . . . . 429

Creating the Enterprise Template for Our Application . . . . . . . . . . . 430

Setting References and Dependencies Between

Different Layers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 432

Adding Code to Support Enterprise Services . . . . . . . . . . . . . . . . . . 436

Implementing the Data Factory Class and the Typed

Datasets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440

Implementing Specific Data Classes for SQL Server. . . . . . . . . . . . 447

Implementing the MSMQ Functionality . . . . . . . . . . . . . . . . . . . . . . . 451

Enabling Our Facades for Web Service Access. . . . . . . . . . . . . . . . . 455

Enabling Security in Our Application. . . . . . . . . . . . . . . . . . . . . . . . . . 458

Changing the Layers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 463

Testing the Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 466

Deploying the Application. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 468

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472

■CONTENTS xiii

5416chFM.qxd 9/21/05 5:35 PM Page xiii

■APPENDIX A Test Equipment At Dell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473

■APPENDIX B Coding Conventions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475

Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475

Naming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 478

Class Naming Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 478

Interface Naming Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 478

Enumeration Naming Guidelines. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479

Read-Only and Const Field Names . . . . . . . . . . . . . . . . . . . . . . . . . . . 479

Parameter Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479

Method Naming Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480

Property Naming Guidelines. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480

Event Naming Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480

Variables Naming Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481

Database Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482

Error Handling and Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 483

Structured Exception Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484

Error Raising and Handling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484

Miscellaneous . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487

■INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489

xiv ■CONTENTS

5416chFM.qxd 9/21/05 5:35 PM Page xiv

cafac74dd2d083cbec0906b66fcd56b1

Tải ngay đi em, còn do dự, trời tối mất!