Serviced Component

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bharathreddy
    New Member
    • Aug 2006
    • 116

    #1

    Serviced Component

    In .Net COM+ components are referred to as serviced components,

    Namespace: System.Enterpri seServices;



    Advantage of Serviced Components:

    object pooling,
    database connection pooling,
    sharing resources,
    role based security,
    distributed transaction processing monitoring(COM+ )
    Use the component registered on other servers


    That means that

    You can re use a component, thus avoiding the creation of the component each time its requested.
    You can set the permissions so that you can control the users\groups who can create and invoke component \ functions \ methods
    For ex: you can set that users\accountsu sers to invoke a finance component and users\accountma ngers to invoke finance.CreateB udget method.
    You can control the tranasactions via components on multiple servers. i.e Billing component will be succesfull after only the sales component is successful, and sales component is successful only after the stocks component.


    Activation:



    You can run \ activate serviced component in two ways

    ActivationOptio n.Library.-( in-process) serviced component will be activated in the client's process space by specifying the value



    ActivationOptio n.Server.-( out-of-process) assembly will be activated in the COM+ executable process space by setting the ApplicationActi vation attribute to ActivationOptio n.Server

    The above information must be specified in AssemblyInfo.

    COM+ server application ( serviced component ) runs in the process space of the COM+ executable (dllhost.exe).



    Requriments:



    Comvisible should be set to true
    StrongName for the assembly


    Running the application:



    .Net creates the Serviced component itself if you run the application in .Net IDE.

    Activation by server method:

    · Open component services from Administrative Tools. You have to set the permissions

    by adding the roles called User and CreatorOwner to the roles folder of the component. To those roles add the userid \ groups who can access the component and set the identity in the Properties of the component, the component will take the identity specified to activate.

    · Also you need to call the gacutil utility with command switch i as arguments for the serviced component dll.

    Activation by Library method:

    .Net IDE will take everything for you



    Deployment:

    Generally there are three ways of deploying a .serviced component:

    Using the Regsvcs command line utility
    This command line utility takes the name of the assembly as the input, creates a type library by reading the assembly, and finally registers the object with COM+.
    Using the automatic registration mechanism provided by the .NET Framework
    At runtime, the CLR (Common Language Runtime) automatically creates a type library based on the assembly and COM+ uses the information present in the type library to install the objects. This is called lazy registration and this method works only for library applications.
    Using the RegistrationHel per class that is part of the System.Enterpri seServices namespace.
    The InstallAssembly method of the RegistrationHel per class can be used to programmaticall y register .NET objects with COM+.
    Steps for depolyment:

    Server Activation:

    You have to call regsvcs for the serviced component dll.
    call the regasm for the serviced component dll.
    call the gacutil utility with command switch i as arguments. for the serviced component dll. Make sure its installed in Windows\Assembl y Folder.
    Open component services from Administrative Tools. You have to set the permissions
    by adding the roles called User and CreatorOwner to the roles folder of the component. To those roles add the userid \ groups who can access the component and setting the indentity in the Properties of the component, the component will take the identity specified to activate.

    Library Activation:

    You have to call regsvcs for the serviced component dll.
    Creation of Proxy:

    To invoke Serviced component available on system A from system B, create a proxy out of the registerd com+ (serviced component) available on System A and register the proxy on System B.

    Debugging

    Library Activation:

    You can directly run the component and debug in .Net IDE

    Server Activation:

    You have to debug by attaching to the the process of dllhost.exe and your break point will be hit in the .NetIDE

    How Serviced component works:

    First, it registers the CLR assembly as a COM component (as if you had run the Assembly Registration Utility, regasm.exe).
    Second, it emits a COM type library (as if you had run the Assembly to Type Library Converter, tlbexp.exe) and uses it to deploy the configured classes (that are present in the assembly) in the COM+ catalog.
    Then it creates the target application described in the assembly's ApplicationName and ApplicationActi vation attributes by default.
    Finally, it uses the .NET Reflection APIs to interrogate the meta-data for the configured classes in the assembly and uses that information to programmaticall y update the COM+ catalog so that each class will have the appropriate declarative attribute settings. If a configured class does not have a particular
    declarative attribute, regsvcs.exe will use a default value instead



    Thanks & Regs
    Bharath Reddy VasiReddy
Working...