• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Intro To Enterprise Services
 

Intro To Enterprise Services

on

  • 1,299 views

Intro To Enterprise Services

Intro To Enterprise Services

Statistics

Views

Total Views
1,299
Views on SlideShare
1,299
Embed Views
0

Actions

Likes
0
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Intro To Enterprise Services Intro To Enterprise Services Presentation Transcript

    • Introduction to Enterprise Services Orlando Moreno omoreno@hotmail.com 408.656.2498
    • Enterprise Services leverages the existing COM+ 1.0 services in Windows 2000 such as transactions, role-based security, queued components, object pooling and loosely-coupled events. In addition, COM+ 1.5, present in Windows XP/.NET Server extends the Enterprise Services framework by providing new features such as public/private components, application recycling, configurable isolation levels, and COM+ SOAP services. Any developer interested in creating highly scalable, robust and reliable applications in .NET MUST attend this session. This session will give an introduction to what these services are and how to use Enterprise Services in the .NET universe. 408.656.2498 omoreno@hotmail.com 2
    •  Overview to Enterprise Services  Registration/Deployment  Object Construction  Instance Management  Transaction  Role-based Security  Queued Components  Loosely-Coupled Events  Windows XP/.NET Server 408.656.2498 omoreno@hotmail.com 3
    •  The term Enterprise means different things for different people  Large number of users, scalability and throughput a must  Fewer users, with drastic spikes in load  Few users using many expensive resources  Mission critical, 24x7, zero down time  Sensitive information  Interoperate with a wide range of platforms  Where quality and productivity are top priority  Any application that is not a toy program 408.656.2498 omoreno@hotmail.com 4
    •  Set of component services designed to ease considerably developing Enterprise applications  The result of integrating COM+ into .NET  .NET assemblies mapped to COM+ applications 408.656.2498 omoreno@hotmail.com 5
    • .NET Enterprise Services  Activation  Queued components  Library  Security  Server  Authorization  Service  Authentication  Instance management  Identity  Pooling  Remote calls and Web  JITA Services  Transactions  Combination of the  Concurrency services management  Loosely coupled events 408.656.2498 omoreno@hotmail.com 6
    • Evolution of Enterprise Services  MTS 1.0 1996  MTS 2.0 1998  COM+ 1.0 2000  COM+ 1.5 2001  .NET Enterprise Services (1.0?) 2002  .NET Enterprise Services (2.0?) 2003 (?)  MTS and COM+ were bad technology monikers 408.656.2498 omoreno@hotmail.com 7
    • Agenda  Overview to Enterprise Services  Registration/Deployment  Object Construction  Instance Management  Transaction  Role-based Security  Queued Components  Loosely-Coupled Events  Windows XP/.NET Server 408.656.2498 omoreno@hotmail.com 8
    • Serviced Components  Components using services are called Serviced Components  Must derive from Serviced Component  System. Enterprise Services  Cannot use static members/methods  Cannot have parameterized constructors  Should use interfaces (not have to)  Should use class libraries (not have to)  .NET integration with COM+ is better than COM/VS6.0 408.656.2498 omoreno@hotmail.com 9
    • Registering Assemblies  Can register using RegSvcs.exe  Can register dynamically  Can register programmatically 408.656.2498 omoreno@hotmail.com 10
    • Assemblies and Applications  Application can contain components from multiple assemblies Application 1 Application 2 comp A comp B comp C comp D comp comp comp comp comp A B C D E Assembly 1 Assembly 2 408.656.2498 omoreno@hotmail.com 11
    • Registering Assemblies  Can register using RegSvcs.exe  Can register dynamically  Can register programmatically 408.656.2498 omoreno@hotmail.com 12
    • Manual Registration  Use RegSvcs.exe  Loads and registers .NET assembly  Incompatible attributes detected at registration  Uses existing COM+ app, if exists, by default  Allows individual settings  /c to create new application – error if exists  Can specify app name or ID [assembly: ApplicationName("MyApp")] [assembly: ApplicationID("8BE192FA-57D0-49a0-8608-6829A314EEBE")] 408.656.2498 omoreno@hotmail.com 13
    • Dynamic Registration  Only .NET Clients can use, COM-based ones still must use RegSvcs.exe  Useful only if your components are self- describing through attributes (i.e. no additional config through COM+ services)  Must be a member of Admin group  Triggers dynamic registration based on version number 408.656.2498 omoreno@hotmail.com 14
    • Programmatic Registration  Manual and dynamic registration all use RegistrationHelper class.  You can manually generate code to auto- install/register your components  Please see MSDN documentation on RegistrationHelper 408.656.2498 omoreno@hotmail.com 15
    • Versioning  CLSID’s are still around  RegSvcs uses CLSID’s for components  Any change in component creates new CLSID by default using System.Runtime.InteropServices; [Guid("260C9CC7-3B15-4155-BF9A-12CB4174A36E")] //Specify CLSID [ProgId("My Serviced Component")] //Specify ProgID public class MyComponent :ServicedComponent {…}  Force CLSID despite breaking changes  Useful for development 408.656.2498 omoreno@hotmail.com 16
    • Demo – Component Creation 408.656.2498 omoreno@hotmail.com 17
    • Agenda  Overview to Enterprise Services  Registration/Deployment  Object Construction  Instance Management  Transaction  Role-based Security  Queued Components  Loosely-Coupled Events  Windows XP/.NET Server 408.656.2498 omoreno@hotmail.com 18
    • Object Construction  Can override default object construction for various purposes  Override protected Construct method  Most often used to pass connection strings  Can use attributes to specify construction string 408.656.2498 omoreno@hotmail.com 19
    • Constructor String [ConstructionEnabled(Enabled = true,Default = “Default String")] public class MyComponent :ServicedComponent { public override void Construct(string connStr) { //do something } }  Use attribute to enable/disable construct string usage  Admin defaults will override in component services 408.656.2498 omoreno@hotmail.com 20
    • Agenda  Overview to Enterprise Services  Registration/Deployment  Object Construction  Instance Management  Transaction  Role-based Security  Queued Components  Loosely-Coupled Events  Windows XP/.NET Server 408.656.2498 omoreno@hotmail.com 21
    • Application Activation Type  Can specify application activation type  Server or a library application  Default is library [assembly: ApplicationActivation(ActivationOption.Server)] //or [assembly: ApplicationActivation(ActivationOption.Library)]  ActivationOption.Service may be available in Win XP 408.656.2498 omoreno@hotmail.com 22
    • Activation and Instance Management  Pool per machine in server application  Pool per app-domain in library application 408.656.2498 omoreno@hotmail.com 23
    • Instance Management  Goal:  Provide scalable solution that enables objects to “scale” easily  Scalability defined as:  Many stateless objects, short lifetime with many clients (i.e. internet)  Fewer stateful objects, long lifetimes and with complex logic (i.e. intranet)  Topics discussed is not new to .NET/COM+ 408.656.2498 omoreno@hotmail.com 24
    • Instance Management  Defined as:  Managing access to expensive instances/objects and managing their lifetime  Object Pooling  Maintain a set of objects, or pool, to serve clients  Pool per object type  Just-In-Time Activation (JITA)  References object ONLY when methods are called 408.656.2498 omoreno@hotmail.com 25
    • Object Pooling  When to use?  Creation of object overhead becomes substantial  Limit access to set resource (i.e. db)  The object constructor does most of the work  Initializing variables  Acquiring connections  Retrieving information from files/network shares  Typically found in internet scenarios 408.656.2498 omoreno@hotmail.com 26
    • Object Pooling  Set the min pool size or the max pool size  Set the creation timeout  Time to wait for an object to become available from pool 408.656.2498 omoreno@hotmail.com 27
    • Object Pooling Client creates Get object from pool [Client calls a method] [GC] [no] Is it [yes] Execute Dispose() the method Return to the pool 408.656.2498 omoreno@hotmail.com 28
    • Agenda  Overview to Enterprise Services  Registration/Deployment  Object Construction  Instance Management  Transaction  Role-based Security  Queued Components  Loosely-Coupled Events  Windows XP/.NET Server 408.656.2498 omoreno@hotmail.com 29
    • JITA  When to use?  Client doesn’t need to know particular object reference  Object instantiation is not expensive  Method calls are expensive  Consume many resources  Complex state machine  State management should be based on durable storage  Typically found in intranet scenarios 408.656.2498 omoreno@hotmail.com 30
    • Just In Time Activation (JITA) 1 Client calls a method on proxy, that delegates the call to the 2 object 3 When method returns, object indicates it can be deactivated 4 Interceptor release object, and NULLs its reference to it Client makes another call, the interceptor creates a new objec and delegates the call 4 1 4 1 Interceptor Server Client 3 Object 2 408.656.2498 omoreno@hotmail.com 31
    • Just In Time Activation (JITA) 1 Client calls a method on proxy, that delegates the call to the 2 object 3 When method returns, object indicates it can be deactivated 4 Interceptor release object, and NULLs its reference to it Client makes another call, the interceptor creates a new objec and delegates the call 4 4 Client Interceptor Server Object 408.656.2498 omoreno@hotmail.com 32
    • Attributes  ObjectPoolingAttribute [ObjectPooling(MinPoolSize = 3,MaxPoolSize = 10,CreationTimeout = 60)] public class MyComponent : ServicedComponent {}  JustInTimeActivationAttribute [JustInTimeActivation] public class MyComponent :ServicedComponent { public void MyMethod(long objectIdentifier) { GetState(objectIdentifier); DoWork(); SaveState(objectIdentifier); //inform .NET to deactivate the object upon method return ContextUtil.DeactivateOnReturn = true; } } 408.656.2498 omoreno@hotmail.com 33
    • Object Lifetime  Should always call Dispose() as soon as possible  Unmanaged resources: COM+ Metadata  Ensure maximal efficiency for object pools  For JITA:  [AutoComplete] does auto-deactivation after each method  Manually deactivate with ContextUtil. DeactivateOnReturn 408.656.2498 omoreno@hotmail.com 34
    • Demo – Object Pooling/JITA 408.656.2498 omoreno@hotmail.com 35
    • Agenda  Overview to Enterprise Services  Registration/Deployment  Object Construction  Instance Management  Transaction  Role-based Security  Queued Components  Loosely-Coupled Events  Windows XP/.NET Server 408.656.2498 omoreno@hotmail.com 36
    • Single component/Single resource  I need to ensure (ACID) on one component and resource  Component responsible for enlisting resource  Manual Transactions are often good enough (generally more performant)  Doesn’t need Enterprise Services Client Obj Transaction DB 408.656.2498 omoreno@hotmail.com 37
    • Multiple Component, Single Resources  Scenario:  Multiple components enlisting single resource Transaction Client Obj Obj Obj DB 408.656.2498 omoreno@hotmail.com 38
    • Multiple Component, Single Resources  Scenario is complicated:  Resource should be enlisted just once  By whom? first to access it? first created?  How would components know all that?  Components can be on different machines  Transaction has to flow across machine boundary  One machine can crash, while the other continue processing  Each component can encounter error and abort  Only if they all succeed ask the resource to commit  Somebody has to collect the votes 408.656.2498 omoreno@hotmail.com 39
    • Multiple Components, Single Resource  The resource should be notified about the vote just once  But who knows what is the right thing to do?  Resource can still refuse to commit changes  .NET make this situation as easy as the previous one 408.656.2498 omoreno@hotmail.com 40
    • Multiple Components, Multiple Resources  Multiple components accessing multiple resources, all taking part in same transaction Client Transaction Obj Obj Obj DB DB DB 408.656.2498 omoreno@hotmail.com 41
    • Multiple Components, Multiple Resources  Multiple points of failure  Resources must be enlisted, and just once  Who keeps track of what resources are used?  Put that knowledge in your code ?  Components and resources ca be on different machines  Transaction has to flow across machine boundary  Each resource can encounter error with the requested changes and can abort the transaction  .NET Enterprise Services make this as easy as the first one 408.656.2498 omoreno@hotmail.com 42
    • Transactions and ES  Use attributes to control transaction options [Transaction(TransactionOption.Required)] public class ESClass : ServicedComponent {…}  Use ContextUtil for voting ContextUtil.MyTransactionVote = TransactionVote.Abort;  AutoComplete (de-activates JITA too) [Transaction(TransactionOption.Required)] public class ESClass : ServicedComponent { [AutoComplete] public SomeMethod(int a, int b) {…} } 408.656.2498 omoreno@hotmail.com 43
    • Demo – Transactions 408.656.2498 omoreno@hotmail.com 44
    • Agenda  Overview to Enterprise Services  Registration/Deployment  Object Construction  Instance Management  Transaction  Role-based Security  Queued Components  Loosely-Coupled Events  Windows XP/.NET Server 408.656.2498 omoreno@hotmail.com 45
    • Role-Based Security  COM+ (ES) role-based security is different from .NET role-based security  .NET role is based on a Windows User Group  COM+ roles can be application specific and or attributed to interfaces/methods 408.656.2498 omoreno@hotmail.com 46
    • Role-Based Security  Security Identity – defined as the current windows user  Authentication  Verification of who the user claims to be  Verification of data integrity (COM+ does this via checksum/packet or encryption)  Authorization – i.e. access control  What does the user have access to? 408.656.2498 omoreno@hotmail.com 47
    • Role-Based Security  .NET Attributes  ApplicationAccessControlAttribute configures all settings on the security tab [assembly: ApplicationActivation(ActivationOption.Server)] [assembly: ApplicationAccessControl( true,//Authorization AccessChecksLevel=AccessChecksLevelOption.ApplicationComponent, Authentication=AuthenticationOption.Packet, ImpersonationLevel=ImpersonationLevelOption.Identify)] 408.656.2498 omoreno@hotmail.com 48
    • Assigning Roles to Component, Interface, Method  Use SecurityRole attribute [assembly: SecurityRole("Role1")] [assembly: SecurityRole("Role2")] [assembly: SecurityRole("Role3")] [SecurityRole("Role2")] interface IMyInterface { [SecurityRole("Role3")] void MyMethod(); } [SecurityRole("Role1")] [ComponentAccessControl] public class MyComponent : ServicedComponent, IMyInterface {} 408.656.2498 omoreno@hotmail.com 49
    • Agenda  Overview to Enterprise Services  Registration/Deployment  Object Construction  Instance Management  Transaction  Role-based Security  Queued Components  Loosely-Coupled Events  Windows XP/.NET Server 408.656.2498 omoreno@hotmail.com 50
    • Queued Components  What are Queued Components?  A way of making asynchronous calls to (remote) object methods  Uses MSMQ as the transport layer  Allows for messaging based processes and business workflows  Allows for buffering of workloads and increased scalability  Supports transactions 408.656.2498 omoreno@hotmail.com 51
    • Queued Components  The Recorder – acts like client proxy  Lives on client  Converts method calls to MSMQ messages  The Player -- acts as stub to proxy  Translates MSMQ messages to method calls  The Listener – lives in component app-domain  Serves multiple components  One listener per application queue  Creates proper player object to retrieve messsages 408.656.2498 omoreno@hotmail.com 52
    • QC Architecture IMyInterface 6 Client Player My Component 1 5 4 IMyInterface MSMQ 3 Recorder Listener 2 ISomeInterface Player Some Note: There are actually 2 queues, Component one for the client and the other for the endpoint 408.656.2498 omoreno@hotmail.com 53
    • QC Attributes  ApplicationQueuingAttribute – tells RegSvcs.exe to create public queue support  InterfaceQueueAttribute – enables queuing support for interface  No support for in, in/out, retval IDL attributes  In .NET that means by value only 408.656.2498 omoreno@hotmail.com 54
    • 408.656.2498 omoreno@hotmail.com 55
    • Agenda  Overview to Enterprise Services  Registration/Deployment  Object Construction  Instance Management  Transaction  Role-based Security  Queued Components  Loosely-Coupled Events  Windows XP/.NET Server 408.656.2498 omoreno@hotmail.com 56
    • Loosely-Coupled Events  COM+ or LCE events are used to de-couple components  COM+ provides subscriber/publisher filtering to control event delivery  Event notification can be uncoupled from client via QC 408.656.2498 omoreno@hotmail.com 57
    • Agenda  Overview to Enterprise Services  Registration/Deployment  Object Construction  Instance Management  Transaction  Role-based Security  Queued Components  Loosely-Coupled Events  Windows XP/.NET Server 408.656.2498 omoreno@hotmail.com 58
    • Windows XP/.NET Server  Private components – create components that are only accessable within the context of a COM+ application  Isolation Levels – control locking on a component level  Application Recyling – COM+ applications will recycle based on set parameters  Image Dumps  COM+ Soap Web Services 408.656.2498 omoreno@hotmail.com 59
    • VB.NET Upgrade Day  Tell your friends… 408.656.2498 omoreno@hotmail.com 60
    • 408.656.2498 omoreno@hotmail.com 61
    • Orlando Moreno omoreno@hotmail.com 408.656.2498 408.656.2498 omoreno@hotmail.com 62