ebook img

Advanced .NET Remoting PDF

422 Pages·2002·9.004 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Advanced .NET Remoting

Advanced Remoting .NET INGORAMMER APress Media, LLC Advanced .NET Remoting Copyright ©2002 by Ingo Rammer Originally published by Apress in 2002 AAllii rriigghhttss rreesseerrvveedd.. NNoo ppaarrtt ooff tthhiiss wwoorrkk mmaayy bbee rreepprroodduucceedd oorr ttrraannssmmiitttteedd iinn aannyy ffoorrmm oorr bbyy aannyy mmeeaannss,, eelleeccttrroonniicc oorr mmeecchhaanniiccaall,, iinncclluuddiinngg pphhoottooccooppyyiinngg,, rreeccoorrddiinngg,, oorr bbyy aannyy iinnffoorrmmaattiioonn ssttoorraaggee oorr rreettrriieevvaall ssyysstteemm,, wwiitthhoouutt tthhee pprriioorr wwrriitttteenn ppeerrmmiissssiioonn ooff tthhee ccooppyyrriigghhtt oowwnneerr aanndd tthhee ppuubblliisshheerr.. ISBN 978-1-59059-025-6 ISBN 978-1-4302-0833-4 (eBook) DDOOII 1100..11000077//997788--11--44330022--00883333--44 TTrraaddeemmaarrkkeedd nnaammeess mmaayy aappppeeaarr iinn tthhiiss bbooookk.. RRaatthheerr tthhaann uussee aa ttrraaddeemmaarrkk ssyymmbbooll wwiitthh eevveerryy ooccccuurrrreennccee ooff aa ttrraaddeemmaarrkkeedd nnaammee,, wwee uussee tthhee nnaammeess oonnllyy iinn aann eeddiittoorriiaall ffaasshhiioonn aanndd ttoo tthhee bbeenneeffiitt ooff tthhee ttrraaddeemmaa..rrkk oowwnneerr,, wwiitthh nnoo iinntteennttiioonn ooff iinnffrriinnggeemmeenntt ooff tthhee ttrraaddeemmaarrkk.. TTeecchhnniiccaall RReevviieewweerr:: KKeenntt SShhaarrkkeeyy EEddiittoorriiaall DDiirreeccttoorrss:: DDaann AApppplleemmaann,, PPeetteerr BBllaacckkbbuurrnn,, GGaarryy CCoorrnneellll,, JJaassoonn GGiillmmoorree,, KKaarreenn WWaatttteerrssoonn,, JJoohhnn ZZuukkoowwsskkii MMaannaaggiinngg EEddiittoorr:: GGrraaccee WWoonngg PPrroojjeecctt MMaannaaggeerr:: AAlleexxaa SSttuuaarrtt CCooppyy EEddiittoorr:: AAmmii KKnnooxx PPrroodduuccttiioonn EEddiittoorr:: JJuulliiaannnnaa SSccootttt FFeeiinn CCoommppoossiittoorr aanndd mmuussttrraatt oorr:: IImmpprreessssiioonnss BBooookk aanndd JJoouurrnnaall SSeerrvviicceess,, !!nnee.. llnnddeexxeerr:: VVaalleerriiee HHaayynneess PPeerrrryy CCoovveerr DDeessiiggnneerr:: TToomm DDeebboollsskkii MMaarrkkeettiinngg MMaannaaggeerr:: SStteepphhaanniiee RRooddrriigguueezz TThhee iinnffoorrmmaattiioonn iinn tthhiiss bbooookk iiss ddiissttrriibbuutteedd oonn aann ""aass iiss"" hhaassiiss,, wwiitthhoouutt wwaarrrraannrryy.. AAlltthhoouugghh eevveerryy pprreeccaauuttiioonn hhaass bbeeeenn ttaakkeenn iinn tthhee pprreeppaarraattiioonn oofftthhiiss wwoorrkk,, nneeiitthheerr tthhee aauutthhoorr nnoorr AApprreessss sshhaallll hhaavvee aannyy lliiaabbiilliittyy ttoo aannyy ppeerrssoonn oorr eennttiirryy wwiitthh rreessppeecctt ttoo aannyy lloossss oorr ddaammaaggee ccaauusseedd oorr aalllleeggeedd ttoo bbee ccaauusseedd ddiirreeccttllyy oorr iinnddiirreeccttllyy bbyy tthhee iinnffoorrmmaattiioonn ccoonnttaaiinneedd iinn tthhiiss wwoorrkk.. TThhee ssoouurrccee ccooddee ffoorr tthhiiss bbooookk iiss aavvaallllaabbllee ttoo rreeaaddeerrss aatt hhttttpp::////wwwwww..aapprreessss..ccoomm iinn tthhee DDoowwnnllooaaddss sseeccttiioonn.. ToKatja Bach day that starts with you being nearby can only turn out great. Iloveyou. Contents at a Glance About the Author .....................................................x i About the Technical Reviewer ......................................x i Acknowledgments ....................................................x iii Introduction .........................................................x v Chapter 1 Introduction to Remoting ................ ~ .............. 1 Chapter 2 • NET Remoting Basics ...................................9 Chapter 3 Remoting in Action .................................... .27 Chapter 4 Configuration and Deployment .........................8 7 Chapter 5 Securing. NET Remoting ...............................1 25 Chapter 6 In-Depth .NET Remoting ............................... 135 Chapter 7 Inside the Framework .................................2 01 Chapter 8 Creation of Sinks .................................... .237 Chapter 9 Extending. NET Remoting ..............................2 49 Chapter 10 Developing a Transport Channel .....................3 17 Chapter 11 Context Matters .......................................3 75 Index ................................................................3 93 v Contents About the Author ................................................x i About the Technical Reviewer ..............................x i Acknowledgments ................................................x iii Introduction .....................................................x v Chapter 1 Introduction to Remoting .....................1 What 1s Remoting? ....................................................1 Scenarios for . NET Remoting ........................................2 Evolution of Remoting ...............................................3 Summary ................................................................ 7 Chapter 2 • NET Remoting Basics ...........................9 Advantages of • NET Remoting ........................................9 Your First Remoting Application ..................................1 4 Summary ...............................................................2 6 Chapter 3 Remoting in Action ............................. 27 Types of Remoting ...................................................2 7 Types of 1nvocation ................................................5 2 Mul tiserver Configuration .........................................6 8 Shared Assemblies .................................................. .77 Summary ...............................................................8 6 Chapter 4 Configurat ion and Deployment .............. 87 Configuration Files ................................................8 8 Deployment ..........................................................1 11 Summary ..............................................................1 23 vii Contents Chapter 5 Securing. NET Remoting ...................... 125 Deployment for Authenticated Use ................................ 125 Deployment for Encrypted Use ..................................... 133 Summary ..............................................................1 34 Chapter 6 In-Depth. NET Remoting ....................... 135 Managing an Object s Li fetime .................................... 135 I The Ins and Outs of Versioning .................................. 162 Using Asynchronous CaUs ......................................... 179 Remoting Events ....................................................1 85 Summary .............................................................. 199 Chapter 7 Inside the Framework ........................ .201 Looking at the Five Elements of Remoting .......................2 01 Client-Side Messaging .............................................2 14 Server-Side Messaging .............................................2 16 Al! About Asynchronous Messaging ................................2 22 Summary ..............................................................2 36 Chapter 8 Creat ion of Sinks ............................. 237 Understanding Sink Providers .....................................2 37 Using Dynamic Sinks ...............................................2 46 Summary ..............................................................2 48 Chapter 9 Extending. NET Remoting .................... 249 Creating a Compression Sink ......................................2 50 Encrypting the Transfer .......................................... .269 Passing Runtime Information ......................................2 86 Changing the Programming Model ..................................2 99 Using a Custom proxy ..............................................3 08 Summary ..............................................................3 16 viii Contents Chapter 10 Developing a Transport Channel ..........3 17 Protocol Considerations ...........................................3 17 Encapsulating the Protocols .......................................3 23 Implementing the Client Channel .................................3 46 Implementing the Server Channel .................................3 55 Wrapping the Channel ..............................................3 66 Using the SMTPChannel .............................................3 69 Summary ..............................................................3 73 Chapter 11 Context Matters ..............................3 75 Working at the MetaData Level ....................................3 77 Creating a Context .................................................3 78 Checking Parameters in an IMessageSink .........................3 87 Summary ..............................................................3 91 Conclusion ..........................................................3 92 Index ................................................................ 393 ix About the Author INGO RAMMER is CEa and cofounder of Sycom Software, an Austrian software con sulting company. He started his professional career years ago with obscure scripting languages such as Perl and Tcl/Tk on various versions of Unix. Shortly after this he converted to the Windows platform and created some large-scale distributed applications with Visual Basic and ASP. He implemented cross platform remote procedure calls using XML and HTTP POST way before the term "Web Services" had been coined for this technology, and he still focuses on the integration of applications written in different programming languages and platforms. About the Technical Reviewer KENT SHARKEY is currently employed at Microsoft as a Technical Evangelist for the .NET Framework and Visual Studio .NET. He roams the land striving to smite the heretics, convert the heathens, and celebrate the faithful. In between he sleeps (far too little), bangs his head against the .NET Framework (far too often, with little result), and tries to help everyone however he can. He lives in Redmond with the three women ofhis life: Margaret (the wife), Squirrel (the warrior), and Cica (the princess). xi Acknowledgments 1 STARTED WRITJNG MY FIRST computer programs mostly due to my father, who was interested in computers at a time when only a few people saw the potential in this upcoming technology. His enthusiasm about computers made it possible for me to play around with such weird devices as the Commodore Plus 4, the Sinclair QL, and the Philips MSX-2 at about the age often or eleven. AlI ofthose comput ers had one thing in common-as soon as they had been powered on, you landed in the programming language, which of course was BASIC at that time (the real one, when AUTO 10 was essential). Learning to program computers therefore has been an almost natural activity for me. 1 reaUy want to thank both my mother Helga and my father Willi for giving me agreat childhood and for providing me with aU the support 1 needed to quench my thirst for knowledge at this time. The person who shaped the greatest part of my professionallife was Juergen Nitsche, who dared to employ me as the lead programmer for a series of custom business applications when 1 was a 16-year-old high school boy. This part nership turned out so well that about four years later we founded our own company, of which we both are still CEOs and owners. Thanks for your trusting me from the beginning. 1 also want to say thanks to my fellows at the NOVA framework team, espe cially Christian "Gumbo" Wehrl and Harald Haefele, for bearing with myabsence during the course of writing this book and for aU the great VB vs. Java vs. C++ vs . .N ET discussions we had. Best wishes also to Robert "Stony" Steinfest, who has the most interesting developer personality I've ever come across. Your unique, friendly way of dealing with users, testers, and junior programmers alike reaUy is legendary. You guys are brilliant! As 1 sometimes get too obsessed about working with Microsoft technology, kudos go out to Edgar Hucek and Markus Gaertner for reminding me that this world is about choices. (That is, Ed is a real Open Source fan and Markus is the best Java guru I've gotten to know.) 1 also want to thank Jay "Saurik" Freeman for creating the Anakrino MSIL to-C# decompiler. This tool aUowed me to understand the .NET Remoting Framework at a level that made it possible for me to write this book. !fyou also want or need to understand one or another part of the .NET platform, be sure to grab a free copy of this tool at http://www • ana krino. org. Last but not least, this book would not have been possible without the great Apress team who worked with me during the last months. This starts with Dan Appleman and Gary Cornell, whogave me the opportunity to write for the best publisher when it comes to .NET books. 1 also want to thank Kent Sharkey from Microsoft for agreeing to tech review this book. My biggest thanks go out to Ami xiii

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.