Net2

  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Net2 as PDF for free.

More details

  • Words: 9,342
  • Pages: 29
CONTENTS:1.Transactions & COM+ 2.Serialization&Deserialization 3.Remoting 4.Tracing 5.Webservices 6.Configuration Settings 7.Queued Components 1.TRANSACTIONS AND COM+:What is COM? Component Object Model (COM) is a Microsoft standard for developing component based software. COM provides :   

A defination - or model- for an object Services for creation and destruction of the object Services for communication between client and server

COM reuses the code in binary form. This makes it possible to write the component with different tool and use it in some other tool.

The term COM means many different things to many people. One one hand it can be defined as A specification for writing reusable software that runs in component based systems. On the other hand it can be defined as It’s a Sophisticated infrastructure that allows clients and objects to communicate across a process and coputerboundaries. COM allows to create objects across the network COM is based on OOP.COM exploits the OOPs Paradigm to achive higher levels of reuse and maintainability that is possible with other models of binary reuse. COM programming model is based on distribution of class code in binary components,this means COM can be reused without any dependencies on source code. COM is founded on the Idea of Interface Based Progarming.An interface , like a class, is a distinct datatype.Itdeines a set of public methods without including any implementation. In other sense, an Interface defines a very specific protocol for the communication that occurs between a client and an Object.It allows developers to do manythings that would be otherwise be impossible.

What are Advantages of COM?

 



Binary code reuse : You can write and use your COM components with different COM complient development tools like VB, VC++,Delphi etc. Cross-platform development : Eventhough Windows is the ultimate platform for COM development. COM can be used for other platforms also. Some vendors are providing support for UNIX. Version Control : COM components are said to be self-versioning. You can install multiple versions of same COM component on the same machine.Your older applications continue to wotk the same way and you are free to utilize new functionality of the component for new applications

What are interfaces? Interface is a set of properties and methods through which client and server component communicate with each other. Interfaces just provide details like method name, its parameters , return type etc. and not the actual implementation of the method. If you are a VB programmer then you can look at it this way- each class within your EXE or DLL(which is a set of properties and methods) project represents an interface.

What are the requirements of a COM component? To be recognised as a COM component all the objects must satisfy following conditions :  

The object must be able to keep track of no. of connections made to it The object must be capable of being queried by client for the methods or properties.

This functionality is provided by an interface called IUnknown. This interface has following methods :   

AddRef : called when a new client connects to it i.e. when you say Set x=new ... Release : called when the object is destroyed i.e. when you say Set x=nothing QueryInterface : which can query for methods supported by the object. VB does this automatically when you say Set x=new...

What are different types of COM components in VB?   

ActiveX DLL ActiveX EXE ActiveX Controls



ActiveX Documents

What are in-process components ? In process components are ActiveX DLLs which run in the same address space as that of client. The communication between client and in-process server is fast but if the server crashes it can also cause the client to crash.

What are out-of-process components? Out-of-process components are ActiveX EXEs which run in their own address space. The communication between client and out-of-process server is slow because of marshalling. If the server crashes the client can still continue to function as the two processes are different.

What is marshalling? When a client calls a method from out-of-process server component the required parameters need to be sent across process boundries. Packaging and transporting of all parameters and return values between client and server is known as Marshalling.

What is instancing of a component? When you open an ActiveX DLL or EXE project each class has a designtime property called Instancing. This property determines how your objects will be created. There are three main catagories :   

Single use : in which case each requesting client is provided with new copy of the component Multi use : in which case multiple clients share the same instance of the component PublicNotCreatable : this means instance of your component can not be created directly by 'New' or 'CreateObject' but some other component returns one to you(generally as return value from a function).

What is most efficient way to create objects? In VB you can create objects using following methods :   

dim x as new myclass dim x as myclass set x=CreateObject("progID") dim x as myclass set x=new myclass

Out of these methods the first method is least efficient and you should actually never use it(unless you are doing testing etc.) The second method uses standard COM services and is the only way to use in scripting languages like VBScript. If you are coding in VB and creating multiple instances of same class then try using last method instead The last method also uses standard COM services but is optimised for creating multiple objects of same class. Thus it is the most efficient.

How do I provide events to my class? There are four basic steps in designing and using an event :    

Declare an event in your class public Event myevent(param1 as integer) Raise event in some of the method of the class RaiseEvent myevent(100) Now, at client side declare object of your class dim WithEvents x as new myclass Write code to handle myevent event public sub myevent(param1 as integer) msgbox param1 end sub

What is RPC? COM ‘s Support for distributed applications is based on an Interprocess Mechanism Names RemoteProcedureCall(RPC).RPC is an Industry standard that has matured on many platforms. COM and RPC have a symbolicRelationship.COM offers RPC an Object oriented feel and RPC offers COM the ability to serve up objects from across network.COM leverages RPC to transparently call methods on remote computers by sending request and response pockets between clients and objects and how clients still invoke method as usual, as if objects were near by. What is MTS? Microsoft Transaction Server allows middle tier objects running on windows NT server to run and control distributed transactions from the middletier.MTS added lots of critical infrastructure support that wasn’t included with COM .In particular it added new support for Distributedtransactions,Integratedsecurity,threadpooling and Improved configuration and administration. MTS Extended COM’s security model .The rolebased security model of MTS Provides more flexibility and Granularity than the original security model provided by COM.A role is an abstraction that represents a security profile for one or more users in an MTS application. At design time , a developer can setup security checks using

roles in either declarative or programmatic fashion.At Deployment time ,an administrator maps a set of roles to user accounts and group accounts inside a windows NT domain. Another significant feature that MTS added to the platform was a scheme to manage concurrency by conducting thread pooling thread pooling behind the scenes.MTS introduced an abstraction called an Activity which represents a logical thread of execution in an MTS application. MTS programmers should write their applications to provide one activity per client application. The MTS runtime automatically binds logical activities to physical threads. Once the number of clients reaches a predefined threshold ,the MTS runtime begins sharing individual threads across multiple clients. Multitier applications that use a thread pooling scheme scale better than those that use a single threaded model or thread –per-client model.A Single thread model removes any chance of concurrency because it can’t execute ,methods for two or more clients at the same time.A Thread-per-Client model results in unacceptable resource usage in larger applications because of the ongoing need to create and tear down physical threads.Thread-pooling schema create an optimized balance between higher levels of Concurrency and more efficient resource usage. What is Attributed based programming? MTS introduced a very important concept to the platform’s programming model: Attribute-based Programming. In this Services provided by patform are exposed through declarative attributes. Attribute settings are determined by programmers at deign time and can be reconfigured by administrators after an application has been put into production. Attribute based programming is very different from the way that most Operating Systems have exposed system services in past. Traditionally , Operating systems have exposed services through a set of functions in a call-level application programming interface(API).In this model , an application leverages system services by making explicit calls to the API. This means that you must compile explicit system-level calls into your application. If you want to change the way you use a system service after an application is already in production, you must modify your code and recompile the application. A programming model based on declarative is much more flexible. For eg A Component in an MTS Application has an Attribute that tells the MTS Environment whether it supports transactions. If a programmer marks a component to require transaction, Objects instantiated from the components are created inside the context of a logical MTS Transaction. When a client calls one of these transactional objects ,the MTS runtime automatically makes a call to start a Physical Transaction. It also makes the appropriate call to either Commit or rollback transaction. The point is that programmer never make explicit calls to start ,Commit, or Abort a Transaction.All the necessary calls are made behind the scenes of MTS Runtime. What is the Attributed based programming model better than the older procedural model, which requires explicit API calls? 1.The new model requires Less Code and You indicate your preferences at design time by setting attributes and the underlying runtime makes sure your needs are met. 2.That Administartors can easily reconfigure the way application uses a system service.

What is Interception? The Attribute based programming model of MTS relies on a mechanism known as Interception.When a client creates an object from a component that has been configured in an MTS application , the underlying runtime inserts an interception layer .The interception layer represents a hook that allows the MTS runtime to perform system supplied preprocessing and PostProcessing on method calls.The system steals way control right before and after an Object executes the code behind each method. NB:- COM has its own Programming model and runtime layer. MTS has a different programming model and a separate runtime layer. But you could see that MTS is simply a layer that has been built on top of COM. What is COM+? What are its features? All the best ideas of COM and MTS have been integrated into a new runtime named COM+. Like COM, COM+ is based on binary components and Interface-based programming. (1)Method calls are remoted across process and computer boundaries through the use of a transparent RPC Layer(2). And like COM ,COM+ components can be upgraded and extended in production without adversily affecting the client applications that use them(3) Like MTS,COM+ supports distributed Transactions(1) and Role-based security(2).It provides built in Thread pooling scheme as transparent as MTS(3).The COM+ programming model also uses Interception to expose platform services to developers through declarative attributes(4).Hower,COM+ takes attribute programming much faster than MTS. In addition to transactional services and integrated security,COM+ exposes services such as CustomObjectContruction(5),Synchronization(6) and ObjectPooling(7).Other new features such as QueadComponents (8)and COM+ Events(9) are Also Exposed Through Configurable attributes. What is Configured Component? A component that has been installed in a COM+ Application is known as a Configured Component, primarily because it has associated COM+ attribute settings. If you want your components take advantage of COM+ services, you must install them in a COM+ application. When a component is installed in a COM+ application, its given a profile in a system catalog called COM+ registrationDatabase(RegDB).The catelog holds configured attribute settings for components as well as for COM+ applications. What is Non-Configured Component? The components that doesn’t have associated COM+ attributes are known as NonConfigured Component. Theses components are not installed in COM+ applications. Instead they registered in a manner consistent with earlier vertions of COM.These components can’t take advantages of COM+Services. Eg ADO(Activex Data Objects) What are COM+ Services? 1.Automatic Transaction Processing 2.Just-in-time activation 3.Loosly-coupled events.

4. Object contruction 5. Object pooling 6. Queued components 7.Private Components 8.Role Based Security 9. SOAP services 10.Synchronization What is Automatic Transaction Processing? Automatic Transaction Processing is a service provided by COM+ that enables you to configure a class at design time to participate in a transaction at runtime.To use this service the class must derive directly or indirectly from the System.EnterpriseServices.Serviced Component class. What is Transaction TimeOut? COM+ allows you to specify a different Transaction timeout for each class that requies a transaction. You can use this to resolve conflicting time-out scenarios, Such as forcing short transactions versus allowing long-running batch stored procedures. What is Transaction? A transaction is a set of related tasks that either succeed or fails as a unit. In transaction Processing Terminology, the transaction either commits or fails as a unit. For a transaction to commit, all participants must guarantee that any change to data will be permanent. What are ACID Properties? The term ACID Conveys the role transactions play in applications. ACID stands for Automicity, Consistency, Isolation and Durability. Automicity:A Transaction is a unit of work in which a series of Operations occur between the BEGINTRANSACTION and ENDTRANSACTION statements of an application. A Transaction executes exactly once and is Automic-all the work is done or none of it is. Operations associated with a transaction usually share a common intent and are Interdependent. Consistency:A Transaction is a unit of integrity because it preserves the consistency of Data, Transforming one Consistent state of data into another consistent state of data.

Some of responsibility for maintaining consistency falls to the application developer who must make sure that all known integrity constraints are enforced by the application. Isolation:A transaction is a unit of Isolation-Allowing concurrent transactions to behave as though each were the only transaction running in the system. Isolation requires that each transaction appear to be the only transaction manipulating The datastore,even other transactions may be running at the same time. A transaction never sees the intermediate stages of another transaction. Transactions attain the highest level of isolation when they are serializable. At this level, the results obtained from a set of Concurrent transactions are identical to the results obtained from set of concurrent transactions are identical to the results obtained by running each transaction serially. Because a high degree of isolation can limit the number of Concurrent transactions, some applications reduce the isolation level in exchange for better throughput. Durability:A Transaction is also a unit of recovery. If a transaction succeeds, the system guarantees that its updates will persist, even if the computer crashes immediately after the commit. Specialized logging allows system’s restart procedure to complete unfinished operations, making transactions durable. What are Transaction Boundaries? A Transaction boundary defies the scope of a transaction.Objects inside a transaction boundary share a common Transaction Identifier. As transaction executes, various transaction-aware resources may participate in the transaction. For example , if within the scope of transaction , your application connects to a database, the transaction flows to that resource and extends the transaction boundary to include the database server. You control over Transaction boundary varies depending on the transaction model you select for your application. Manual or Automatic. In Manual Transaction you control transaction boundaries with explicit instructors to begin and end the transaction. From one transaction boundary , you can begin a second transaction, called a nested transaction. The parent transaction doesnot commit until all its subordinate transactions commit. An Automatic Transaction manages transaction boundaries for you, based on a declarative attribute set for each component.A transaction automatically flows to objects instructed to participate in a transaction and by passes objects instructed to execute outside a transaction. You cannot nest transactions when using the automatic transaction model. What are Distributed Transactions? Distributed Transaction Processing (TP) systems are designed to facilitate transactions that span heterogeneous, transaction-aware resources in a distributed environment. Supported by a distributed TP system, your application can combine into a Transactional unit such diverse activities as retrieving a message from a

MicrosoftMessageQueing(MSMQ) queue, storing the message in a Microsoft SQL Server database, and removing all existing references to the message from an Oracle Server database.Because they span multiple data sources, its important that distributed transactions enforce ACID Properties to maintain data consistency across all resoucrces. A Distributed TP system consists of several cooperating entities as mentioned below. These entities are logical and can reside on the same computer or on different computer. a)Transaction Processing(TP) Monitors:A TP monitor is software that sits between a transaction-aware application and a collection of resources. It maximizes operating system activities, streamlines network communications and connects multiple clients to multiple applications that potentially access multiple data sources. Instead of writing an application that manages a multi-user, distributed environment, you write an application that consists of a single transaction requests.The monitor scales your application as required. The Distributed Transaction Coordinator(DTC) is the TP Monitor for Microsoft Windows2000. b)Transaction Managers:In a distributed transaction, each participating resource has a local transaction manager(TM) to track incoming and Outgoing transactions on that computer. The TP monitor assigns one TM the additional task of coordinating all activities among local TMs. The TM that coordinates transaction activities is called the roof or coordinating TM. A TM coordinates and manages all transaction processing functions, but it is not equipped to manage data directly. Resource managers handle data related activities. c)Resource Managers:A Resource Manager is a system service that manages persistent or durable data in databases, durable message queues, or transactional file systems. The resource manager stores data and performs disaster recovery. SQLServer,Orcale,sybase,Informix,IBM(for IBM DB2),Ingres and MSMQ provide resource managers that participate in distributes transactions. d)Resource Dispensers:A Resource dispenser manages nondurable state that can be shared.For Example the ODBC resource dispenser manages pools of database connections, reclaiming each connection when it is no longer needed.

NB:-For a .NET Framework object to participate in an automatic transaction, the .NET framework class must be registered with windows 2000 component services. What are Different Transaction Models? a)Automatic Transaction Model b)Manual Transaction Model NB:- MTS,COM+1.0 and the Common Language runtime support the same automatic distributed transaction model. Once ASP.NET page, XML WebServiceMethod or .NET Framework class is marked to participate in a transaction, it will automatically execute within the scope of a transaction. How Automatic Transactions Work? The Declarative transaction attribute specifies how an object participates in a transaction, and is configured programmatically. Although this declarative level represents the logic of a transaction, it is one step removed from the physical transaction. A physical Transaction occurs when a transactional Object accesses a data source, such as a database or message queue. The Transaction associated with the Object automatically flows to the appropriate resource manager. An associated driver, such as OLEDB , ODBC or ADO looks up the transaction in the Object’s context and enlists in the transaction through the Distributed Transaction Coordinator(DTC).The entire physical Transaction occurs automatically. What are the Transaction Directives available in ASP.NET? Directive Disabled NotSupported

Supported Required RequiresNew

Description Indicates that the transaction context will be ignored by ASP.NET. This is the default transaction state. Indicates that the page does not run within the scope of transactions. When a request is processed, its object context is created without a transaction, regardless of whether there is a transaction active. Indicates that the page runs in the context of an existing transaction. If no transaction exists, the page runs without a transaction. The page runs in the context of an existing transaction. If no transaction exists, the page starts one. Indicates that the page requires a transaction and a new transaction is started for each request.

You can indicate the level of transaction support on a page by placing the directive in your code. For example, you can ensure that the page activities always execute in the scope of a transaction by inserting the following directive. <%@ Page Transaction="Required" %> If you omit the transaction directive, transactions are disabled for the page.

What are the Transaction Directives available in ASP.NET? ASP.NET provides built-in support for creating and exposing XML Web services using a programming abstraction that is consistent and familiar to Web Forms. XML Web services provide to you the option of running your code within the scope of an automatic transaction. A transaction ensures that all interactions with resource managers such as SQL Servers, MSMQ Servers, Oracle Servers, and SNA Servers maintain the ACID Properties required to run robust distributed applications. You can declare an automatic transaction by using the TransactionOption property of the WebMethod attribute. Setting the TransactionOption property to TransactionOption.RequiresNew begins a new transaction each time a XML Web service client calls the XML Web service method. What are the Transaction Attributes available in .NET?

Attribute value Disabled

NotSupported

Supported

Required (default) RequiresNew

Description Eliminates the control of automatic transactions on the object. An object with this attribute value applied can engage the Distributed Transaction Coordinator (DTC) directly for transactional support. [Transaction(TransactionOption.Disabled)] Indicates that the object does not run within the scope of transactions. When a request is processed, its object context is created without a transaction, regardless of whether there is a transaction active. [Transaction(TransactionOption.NotSupported)] Indicates that the object runs in the context of an existing transaction, if one exists. If no transaction exists, the object runs without a transaction. [Transaction(TransactionOption.Supported)] Indicates that the object requires a transaction. It runs in the scope of an existing transaction, if one exists. If no transaction exists, the object starts one. [Transaction(TransactionOption.Required)] Indicates that the object requires a transaction and a new transaction is started for each request. [Transaction(TransactionOption.RequiresNew)]

2.SERIALIZATION AND DESERIALIZATION:What is Serialization? Serialization is the Process of Converting an Object into a stream of Bytes, that can be persisted or transported. What is De Serialization? De Serialization is the process of Creating an Object from a stream of Bytes.

Serialization and Deserialization are mostly used to transport Objects(Eg. During Remoting) or to Persist Objects(Eg. To a file or Database). What are Different Types of Serialization Technologies? The .NET Frame work features two serializing technologies. 1.Binary Serialization 2.XML Serialization/Soap Serialization 1.Binary Serialization:Binary Serialization Preserves Type Fiedelity, which is useful for preserving the state of an object between different invocations of an application. During this process , the public and private fields of the object and the name of the class, including the assembly containing the class is converted to a stream of bytes, which is then written to a data stream. Remoting uses binary serialization to pass objects “by value” from one computer, or application domain to another. 2.XML Serialization:XML serializes public properties and fields of an Object , or the parameters and return values of methods, into an XML stream that conforms to a specific XML schema Definition Language(XSD) document and does not preserves type fidelity. This is useful when you want to provide or consume data without restricting the application that uses the data. Because XML is an Open standard, it is an attractive choice for sharing data across the web. It serializes the class that implement ICollection or Ienumerable , XMLelement objects,xmlNodeObjects and Dataset Objects. XML serialization can also be used to serialize objects into XML Streams that conform to the SOAP specification. SOAP is a protocol based on XML, designed specifically to transport procedure calls using XML. Webservices uses XML serialization. XMLSerializer class is used for this. XMLSerialization is slow as there is a once-per-process-per-type overhead with XMLSerializer. 3.REMOTING:What is Remoting? Under .NET framework Remoting provides an infrastructure for developing and using distributed components. Using remoting multiple AppDomains can talk with each other. What are PROXYOBJECTS? While developing a distributed application the underlying framework should provide transparent programming model to the application developer. Proxies play major role in this area. The proxy object acts as a 'dummy' of the remote object and forward all the method calls to the remote object instance. These proxy objects are created at client end (here client simply means a component which is calling the remote object). The client is unaware of the actual location of the remote object and it simply calls the methods on the proxy object which are then forwarded to the actual object. How Activation of RemoteObjects Takes Place? The remote objects can be activated in two ways 

Server Activation



Client Activation

In the server activation managing the life time of the remote object is not in the hands of client where as client activation involves life time management of the remote object. The server activated objects are of two types:  

Single call objects : These objects are state less objects i.e. they do not maintain state across method calls Singleton objects: These objects share the same instance of object among various clients and also maintain state across method calls. Here various clients share the same state information.

Client Activated Objects are created for individual clients and can store state information between method calls for that specific client.

What is Leased based life time? We just mentioned that the client activated objects can control the life time of the remote objects. The mechanism by which it happens is called as Leasing. The remote objects have a default lease period. When the lease expires the object is garbage collected. The client can control the lease period by following ways:   

The server object can set its lease time to infinity The client can renew the lease of the object The client can make use of a sponsor which in turn requests a lease renewal

What are Formatters? The communication between the client and remote object involves method parameters and return values. This data must be serialized before it is sent across the network. The serialization process creates a persistent copy of the data as a sequence of bytes. The process of converting these bytes back into the original data structure is called deserialization. .NET remoting framework provide special objects for performing this serialization and de-serialization. They are called as Formatters. Formatters are available in following namespaces: System.Runtime.Serialization.Formatters.Binary System.Runtime.Serialization.Formatters.SOAP As the names suggest Binary formatter deals with data in binary format while SOAP formatter deals with data in XML format. What are Channels? To communicate with remote object we need a path through which the data transfer can take place. This path is called as Channel. There are two types of channels: 

TCP channels : As the name suggestes these channels us TCP for communication. TCP channels typically carry data in binary form i.e. they use Binary formatters



HTTP Channels : These channels use HTTP for communication. They typically carry SOAP messages i.e. they use SOAP formatters.

TCP channels with Binary formatters are suitable where speed and performance is important where as HTTP Channels with SOAP formatters are suitable for platform independent or over the web communication. The channels are available in following namespaces: System.Runtime.Remoting.Channels.TCP System.Runtime.Remoting.Channels.HTTP You can create your own channels for gaining more control over the transmission process.

How it works? When the client application communicates with the remote object following steps are involved: At Server Side  

A Channel is established at a specific port which will listen all the client requests Remote object registers itself with remoting framework and declares its presence over the network

At Client Site    

Client establishes a channel at a specific port to talk with remote object Client creates an instance of remote object by calling Getobject or CreateInstance or new method. Client gets the proxy for the remote object Client calls remote object methods on the proxy

What is Microsoft Transaction Server?    

MTS is a middle-ware from Microsoft In a n-tire system middleware sits between your business components and client application. It handles all the client requests for the components MTS is a component-based transaction processing system for building, deploying, and administering internet and intranet server applications MTS manages resorses like database connections, threads etc. for your components

What are main parts of systems built around MTS? 

Application components

     

MTS executive Server processes Resource managers Resource despensers MS-DTC MTS explorer

What are application components? Application components are custom components that you design to suit your business needs. These components are in-process(DLL) components which run under the control of MTS. If you are designing components using VB you must make them as ActiveX DLLs with Apartment threading.

What is MTS executive?  

MTS Executive is a DLL that provides run-time services for MTS components like thread and context management This DLL loads into the processes that host application components and runs in the background

What is server process ? A server process is a system process that hosts the application components. A server process can host multiple components.

What are resource managers ?  

A resource manager is a system service that manages transactional data with help of MS-DTC MTS supports resource managers that implement the OLE Transactions protocol e.g. MS-SQL Server

What are resource despensers ? Resource despensers manage system resources like database connections. MTS provides two resource despensers :  

ODBC/OLEDB Resource Dispenser Shared Property Manager

What is MS-DTC ?

Microsoft Distributed Transaction Coordinator is a system service that coordinates transactions. With MS-DTC MTS can handle transactions spanning more than one machines. MS-DTC uses a two-phase commit protocol for transaction management.

What is MTS explorer ? MTS explorer is a GUI for managing and administrating MTS components

How to create transactional components? There are two steps in creating transactional components.  

Inside your component you need to add code which tells MTS weather transaction is completed successfully or not You need to set the transaction attribute of the component inside MTS generally using MTS explorer.

What is Object Pooling? Object pooling is nothing but recycling a certain number of objects among clients requesting them. The client requests for an object. If no instance of the object is available MTS will create a new instanced and give it to the calling client. The client will use the object and inform MTS when done with the help of special methods. MTS will not immediately destroy the object but keep it in 'object pool'. The same instance of the object is supplied to other clients requesting for the same component. Presently(ver 2.0) MTS do not provide object pooling but Microsoft has promised it at some later date. Microsoft has also provided some interfaces which you can use for this forward compatibility. Currently, MTS simply creates and destroys objects rather than recycling them.

What is Connection Pooling? Connection pooling is similar to object pooling but it applies to database connections instead of object instances. MTS does provides connection pooling. Or Connection pooling is recycling of available database connections.Connection pooling is always per user basis i.e. connections set by user A can not be used by user B. Generally, a seperate NT account is create for use by MTS components.

What is general rule while using database connections?

Connect to database as late as possible and release the connection as early as possible

Why MTS components are generally built stateless? Because of object pooling feature of MTS clients are not guareented that between different method calls they will get same object instance. Naturally, storing properties or state in such objects is useless. MTS provides alternative mechanism of state management called 'shared property manager'

What are transaction attributes of MTS components? There are 4 transaction attributes in MTS :    

Requires a transaction : the objects require a transaction. If transaction do not exist a new transaction is started Requires a new transaction : A new transaction is always started for the object Supports a transaction : The object uses a transaction context only if one already exists Does not support transaction : The object do not participate in transaction

You can set these attribute in MTS explorer or if you are working with VB6 you can set the MTSTransactionMode property(which you can change later in MTS explorer)

How does a typical component is built with VB to work under MTS? To create components with VB for MTS you should create ActiveX DLLs with apartment threading model. The classes you create are similar to your normal class modules with some limitations like : 



You should not use functions like MsgBox in the class as the class is running on server and any call to such methods invokes the Msgbox at the server and not at the client You should avoid storing state i.e. properties because of object pooling feature of MTS( presently MTS do not support true object pooling but Microsoft has promised it at later date)

What are Firehose cursors? Firehose cursors are ADO recordset objects with following properties :    

Cursorlocation : aduseServer Cursortype : adOpenForwardOnly LockType : adLockReadOnly Cachesize : 1

When such cursors are created the recordset values are returned generally using GetString or GetRows method of the recordset

What is disconnected recordset? Disconnected recordsets are ADO recordsets with following properties   

Cursorlocation : adUseClient Cursortype : adOpenStatic LockType : adLockBatchOptimistic

Also, you need to set the activeconnection to nothing once you run the query. set rs.ActiveConnection=nothing set myfunction=rs Note that update method on disconnected recordset updates records from the recordset only. To update the changes to the database you must call updatebatch method. What is object pooling? Object pooling is an automatic service provided by COM+ that enables you to configure a component to have instances of itself kept active in a pool, ready to be used by any client that requests the component. You can administratively configure and monitor the pool maintained for a given component, specifying characteristics such as pool size and creation request time-out values. When the application is running, COM+ manages the pool for you, handling the details of object activation and reuse according to the criteria you have specified. You can achieve very significant performance and scaling benefits by reusing objects in this manner, particularly when they are written to take full advantage of reuse. With object pooling, you gain the following benefits: •

• • •





You can speed object use time for each client, factoring out time-consuming initialization and resource acquisition from the actual work that the object performs for clients. You can share the cost of acquiring expensive resources across all clients. You can preallocate objects when the application starts, before any client requests come in. You can govern resource use with administrative pool management—for example, by setting an appropriate maximum pool level, you can keep open only as many database connections as you have a license for. You can administratively configure pooling to take best advantage of available hardware resources—you can easily adjust the pool configuration as available hardware resources change. You can speed reactivation time for objects that use Just-in-Time (JIT) activation, while deliberately controlling how resources are dedicated to clients.

What is JIT(JustInTime) Activation? Just-in-Time (JIT) activation is an automatic service provided by COM+ that can help you use server resources more efficiently, particularly when scaling up your application to do high-volume transactions. When a component is configured as JIT activated, COM+ can deactivate an instance of it while a client still holds an active reference to the object. The next time the client calls a method on the object, which the client believes to be still active, COM+ will reactivate the object transparently to the client, just in time. The advantage of JIT activation is that you enable clients to hold references to objects for as long as they need them, without necessarily tying up server resources—such as memory—to do so. Other benefits include the following: •

From the client perspective, JIT activation greatly simplifies the programming model—the client doesn't have to think about how it uses expensive server objects and server resources. Without JIT activation, when clients are aggressive about releasing server objects, they can incur a significant penalty in frequently calling and releasing objects. Note You can refine this performance benefit further by using object pooling. By pooling JIT-activated objects, you can greatly speed object reactivation for clients while reusing whatever resources they might be holding. And doing this gives you more precise control over how much memory is used by a given object on the server. For more detail, see Object Pooling and JIT Activation.





By holding long-lived object references, clients keep open the channel to the object for as long as they need it. The farther the client is from the server, the greater the benefits of JIT activation become—because without JIT activation, the cost of activating and marshaling the server object, opening the channel, setting up the proxy and stub, and so on is much greater. With distributed applications, an expensive network round-trip is required with every object creation. As the volume of client calls increases, you want to minimize the frequency of object creation because it can significantly affect the performance of your application. When you JIT activate those objects to which clients hold long-lived references, but which they aren't necessarily using all the time, server memory is not always tied up keeping those objects alive. With lazy activation, memory is used only when the objects are actually needed. This can significantly increase the scalability of your application. The only performance hit that clients see is the time it takes COM+ to reactivate the object—usually just marginally more than the time it takes to allocate memory for the object, and substantially less than the network round-trip for remote object creation.

4.TRACING:5.WEBSERVICES:What platforms do .NET XML Web Services run on?

Currently, they're supported on Windows 2000 and Windows XP. ASP.NET integrates with Internet Information Server (IIS) and thus requires that IIS be installed. It runs on server and non-server editions of Windows 2000 and XP as long as IIS is installed. Can two different programming languages be mixed in a single ASMX file? No What is code-behind in Webservices? Code-behind allows you to associate Web Service source code written in a CLR compliant language (such as C# or VB.NET) as compiled in a separate file (typically *.asmx.vb). You would otherwise typically find the executable code directly inserted into the .asmx file. What event handlers can I include in Global.asax? • • • • • • • • • • • • • • • • • •

Application_Start Application_End Application_AcquireRequestState Application_AuthenticateRequest Application_AuthorizeRequest Application_BeginRequest Application_Disposed Application_EndRequest Application_Error Application_PostRequestHandlerExecute Application_PreRequestHandlerExecute Application_PreSendRequestContent Application_PreSendRequestHeaders Application_ReleaseRequestState Application_ResolveRequestCache Application_UpdateRequestCache Session_Start Session_End

You can also include event handlers in Global.asax for events fired by custom HTTP modules. Note that not all of the event handlers make sense for Web Services. For example, the Application_AuthenticateRequest and Application_AuthorizeRequest events are designed to be used with ASP.NET Forms authentication. What namespaces are imported by default in ASMX files? The following namespaces are imported by default. Other namespaces must be imported manually.

• • • • • • •

System System.Collections System.ComponentModel System.Data System.Diagnostics System.Web System.Web.Services

What are ASHX files? ASHX files contain HTTP handlers-software modules that handle raw HTTP requests received by ASP.NET. They are requested using URL http://.../hello.ashx?Name=Cindy, it returns "Hello, Cindy" in the HTTP response. ASHX files provide developers with a convenient way to deploy HTTP handlers without customizing Machine.config or Web.config. ASHX files can also employ codebehind just like ASPX and ASMX files. If I want to charge for a Web service, how do I know who's calling it? While there are probably many possible use models, the three most likely are service agreement, subscription, and per-use. With a service agreement, you and your clients sign agreements indicating the terms of the service. These terms vary widely, as you might imagine. Subscriptions allow your clients to access the Web Service for a given period of time or for a set number of invocations. Assuming their account remains in good standing, you continue to allow them to access your Web Service. Per-use, of course, is billed each time the client uses the Web Service. What is WSDL? WSDL is the Web Service Description Language, and it is implemented as a specific XML vocabulary. While it's very much more complex than what can be described here, there are two important aspects to WSDL with which you should be aware. First, WSDL provides instructions to consumers of Web Services to describe the layout and contents of the SOAP packets the Web Service intends to issue. It's an interface description document, of sorts. And second, it isn't intended that you read and interpret the WSDL. Rather, WSDL should be processed by machine, typically to generate proxy source code (.NET) or create dynamic proxies on the fly (the SOAP Toolkit or Web Service Behavior).

The Web Services Description Language (WSDL) currently represents the service description layer within the Web service protocol stack. In a nutshell, WSDL is an XML grammar for specifying a public interface for a Web service. This public interface can include the following: • • • •

Information on all publicly available functions. Data type information for all XML messages. Binding information about the specific transport protocol to be used. Address information for locating the specified service.

WSDL is not necessarily tied to a specific XML messaging system, but it does include built-in extensions for describing SOAP services. What is UDDI? UDDI stands for Universal Description, Discovery, and Integration. While UDDI is implemented as a series of Web Services that execute against known UDDI repositories, you can imagine UDDI as being a sort of "Yellow Pages" for Web Services. The repositories, maintained by Microsoft, IBM, and Ariba, are designed to provide you with detailed information regarding registered Web Services for all vendors. You query the repositories for specific information and/or Web Services as necessary to discover and ultimately use Web Services provided by any number of vendors. UDDI (Universal Description, Discovery, and Integration) currently represents the discovery layer within the Web services protocol stack. UDDI was originally created by Microsoft, IBM, and Ariba, and represents a technical specification for publishing and finding businesses and Web services. At its core, UDDI consists of two parts. •



First, UDDI is a technical specification for building a distributed directory of businesses and Web services. Data is stored within a specific XML format, and the UDDI specification includes API details for searching existing data and publishing new data. Second, the UDDI Business Registry is a fully operational implementation of the UDDI specification. Launched in May 2001 by Microsoft and IBM, the UDDI registry now enables anyone to search existing UDDI data. It also enables any company to register themselves and their services.

The data captured within UDDI is divided into three main categories: • •

White Pages: This includes general information about a specific company. For example, business name, business description, and address. Yellow Pages: This includes general classification data for either the company or the service offered. For example, this data may include industry, product, or geographic codes based on standard taxonomies.



Green Pages: This includes technical information about a Web service. Generally, this includes a pointer to an external specification, and an address for invoking the Web service.

What is a Web service? Many people and companies have debated the exact definition of Web services. At a minimum, however, a Web service is any piece of software that makes itself available over the Internet and uses a standardized XML messaging system. XML is used to encode all communications to a Web service. For example, a client invokes a Web service by sending an XML message, then waits for a corresponding XML response. Because all communication is in XML, Web services are not tied to any one operating system or programming language--Java can talk with Perl; Windows applications can talk with Unix applications. Beyond this basic definition, a Web service may also have two additional (and desirable) properties:







First, a Web service can have a public interface, defined in a common XML grammar. The interface describes all the methods available to clients and specifies the signature for each method. Currently, interface definition is accomplished via the Web Service Description Language (WSDL). Second, if you create a Web service, there should be some relatively simple mechanism for you to publish this fact. Likewise, there should be some simple mechanism for interested parties to locate the service and locate its public interface. The most prominent directory of Web services is currently available via UDDI, or Universal Description, Discovery, and Integration. Web services currently run a wide gamut from news syndication and stockmarket data to weather reports and package-tracking systems.

 What is new about Web services? People have been using Remote Procedure Calls (RPC) for some time now, and they long ago discovered how to send such calls over HTTP. So, what is really new about Web services? The answer is XML. XML lies at the core of Web services, and provides a common language for describing Remote Procedure Calls, Web services, and Web service directories. Prior to XML, one could share data among different applications, but XML makes this so much easier to do. In the same vein, one can share services and code without Web services, but XML makes it easier to do these as well.

By standardizing on XML, different applications can more easily talk to one another, and this makes software a whole lot more interesting.  What is the Web service protocol stack? The Web service protocol stack is an evolving set of protocols used to define, discover, and implement Web services. The core protocol stack consists of four layers: •







Service Transport: This layer is responsible for transporting messages between applications. Currently, this includes HTTP, SMTP, FTP, and newer protocols, such as Blocks Extensible Exchange Protocol (BEEP). XML Messaging: This layer is responsible for encoding messages in a common XML format so that messages can be understood at either end. Currently, this includes XML-RPC and SOAP. Service Description: This layer is responsible for describing the public interface to a specific Web service. Currently, service description is handled via the WSDL. Service Discovery: This layer is responsible for centralizing services into a common registry, and providing easy publish/find functionality. Currently, service discovery is handled via the UDDI.

Beyond the essentials of XML-RPC, SOAP, WSDL, and UDDI, the Web service protocol stack includes a whole zoo of newer, evolving protocols. These include WSFL (Web Services Flow Language), SOAP-DSIG (SOAP Security Extensions: Digital Signature), and USML (UDDI Search Markup Language). For an overview of these protocols, check out Pavel Kulchenko's article, Web Services Acronyms, Demystified, on XML.com. Fortunately, you do not need to understand the full protocol stack to get started with Web services. Assuming you already know the basics of HTTP, it is best to start at the XML Messaging layer and work your way up.

 What is XML-RPC? XML-RPC is a protocol that uses XML messages to perform Remote Procedure Calls. Requests are encoded in XML and sent via HTTP POST; XML responses are embedded in the body of the HTTP response. More succinctly, XML-RPC = HTTP + XML + Remote Procedure Calls. Because XML-RPC is platform independent, diverse applications can communicate with one another. For example, a Java client can speak XML-RPC to a Perl server. What is SOAP? SOAP is an XML-based protocol for exchanging information between computers. Although SOAP can be used in a variety of messaging systems and can be delivered

via a variety of transport protocols, the main focus of SOAP is Remote Procedure Calls (RPC) transported via HTTP. Like XML-RPC, SOAP is platform independent, and therefore enables diverse applications to communicate with one another. 6.CONFIGURATION SETTINGS:a)TRACE:Trace element allows you to enable or disable application-wide tracing as well as set the parameters for the tracing functionality. When tracing is enabled, you can review information about requests received by the Web Server with the special URL http://<servername>//trace.axd.

1.False-Default 2.Determines whether trace information is viewable by computers other than local webserver. True-Only from Local Webserver—Default False-From Any machine. 3.Determines whether trace output is appended to each ASP.NET page in the application or is available only through trace.axd.(false)—Default 4.Determines the number of requests that are stored for review through the trace.axd URL.once this limit has been reached then the current trace must be cleared by browsing trace.axd in order to collect information on additional requests. The Default is 10, but higher this number ,the more overhead is involved in tracing.Set this number as small as feasible. 5.Determines the sort order of the requests stored. SortByTime-Sorts trace information by the order in which events are processed- Default SortByCategory-Sorts trace information by Alphabetically by category. This is very useful while using Trace.Write method, for grouping statements using the same category argument. b)globalization: element controls globalization settings for ASP.NET applications.This includes the encoding used for requests,responses and files as well as settings for specifying the culture to be associated with web requests and Local Searches.
requestEncoding=” any valid encoding string”-3 responseEncoding=” any valid encoding string”-4 uiCulture=” any valid culture string”-4/> 1.Determines the culture such as language defaults used to process incoming Web Requests. System.Globalization.CultureInfo class provides a list of valid culture strings. 2.Determines type of character encoding used for parsing ASP.NET application files(.aspx,.asmx and .asax).This must be a valid encoding string either in Machine.Config or in Web.config.If both are not available then the coding will be base on Machine’s regional Options setting in control panel. 3. Determines type of character encoding used to process incoming WebRequests. This must be a valid encoding string either in Machine.Config or in Web.config.If both are not available then the coding will be base on Machine’s regional Options setting in control panel. The Default is utf-8. 4. Determines type of character encoding used to encode outgoing responses. This must be a valid encoding string either in Machine.Config or in Web.config.If both are not available then the coding will be base on Machine’s regional Options setting in control panel. The Default is utf-8. 5. Determines the culture such as language defaults used to process searches that are culture or local specific. System.Globalization. CultureInfo class provides a list of valid culture strings. c)httpRuntime:The element controls several aspects of the ASP.NET HTTP Runtime engine. 1.Specifies number of requests that ASP.NET will queue when no threads are available to process them, before returning a “503-server too busy” error message. The Default is 100.Increasing this value may result in unacceptable long wait times for users, so use caution and test carefully when making adjustments to this value. 2.Determines amount of time (sec), that an ASP.NET request may continue executing before being shutdown. This can be used to prevent hung or long-running requests from consuming more resources than necessary.The default is 90 seconds. 3.Determines maximum size of incoming file uploads ,in KB.This attribute is designed to help prevent denial of service attacks mounted by uploading large files to

a server.set it to small size feasible for files you expect your users to upload. The default is 4,096KB. 4.Configures the minimum number of threads ASP.NET will keep free for processing new requests. The Default is 8. 5. Configures the minimum number of threads ASP.NET will keep free for processing requests coming from local machine. Maintaining these free threads can help prevent deadlocks in multithreaded processing. The Default is 4. 6.Determines whether relative or fully qualified URLs (True-Default)are used for client-side redirects. This attribute allows developers to support certain mobile controls that require fully qualified URLs for client-side redirects.False-Relative URLs. D)httpModules:HttpModules are classes that implements IHttpModule interface and are used to provide functionality to ASP.NET assplications.For example , by default , the Machine.Config file adds HttpModules for OutputCaching, Session-state Management, authentication and authorization.The element allows you to add HttpModules to ASP.NET applications. The element supports three child elements,, and and has the following syntax. -3 -5 -6 -Determines the httpModules available for the ASP.NET applications within the scope of configuration file. 1.Each child element adds a specified httpModule. 2.Specifies a name that can be used by ASP.NET applications to refer to the module identified by the type attribute. 3.Specifies the .NET class that implements the desired httpModule. This is string containing a comma separated list with the class name and other information, such as Version and public key, that enables ASP.NET to locate the class in either the application’s bin directory or the global assembly cache. 4.Removes an httpModule based on the name and type attributes specified. 5.Removes all httpModules either those configured by the currentfile or those inherited from the parent configuration files. E)httpHandlers:The element allows you to assign requests of certain types or for certain resources to specific handler classes.

For example, in Machine.Config, the handling of the ASP.NET pages is assigned to the System.Web.UI.PageHandlerFactory class. The element can also be used to prevent HTTP access to certain types of files by assigning them to System.Web.HttpForbiddenHandler class. The element supports three child elements,, and and has the following syntax. < httpHandlers > -5 -8 -9 < /httpHandlers > < httpHandlers >-Determines the assignment of requests to httpHandlers for ASP.NET applications. 1.Each child element maps a specific type of request to a given httpHandler. 2.Specifies the URL path this httpHandler will handle. This can be a single URL as in case of the default mapping of the trace.axd URL to System.Web.Handlers.TraceHandler, or may use a wildcard to specify that the httpHandler should handle all requests of a given type(such as .aspx or .asmx) 3.Specifies the .NET class that should handle the requests specified by the Path and verb attributes. This is string containing a comma separated list with the class name and other information, such as Version and public key, that enables ASP.NET to locate the class in either the application’s bin directory or the global assembly cache. 5.Specifies the HTTP Verbs for which the httpHandler will handle requests. Commaseparated list of verbs(GET,POST) or wild card(such as * which specifies that all verbs should be handled). 6.Removes an httpHandler based on the path and verb attributes specified. 5.Removes all httpHandlers either those configured by the currentfile or those inherited from the parent configuration files.

F)processModel:The <processModel> element configures settings related to how ASP.NET applications run, and it provides access to a number of features geared towards improving the availability of applications. Theses includes automatic restart(which can be configured based on elapsed time or number of requests),allowed memory size and webgarden. Note that when ASP.NET is running under IIS6.O In native mode,the settings in the <processModel> element are ignored in favour of the settings configured by the IIS administrative UI.

<processModel clientConnectedCheck=”time”-00:00:05 comAuthenticationLevel=”Default|None|Connect|Call|Pkt| PktIntegrity|PktPrivacy” comImpersonationLevell=”Default|Anonymous|Identity|Impersonate|Delegate” cpuMask=”number”-0xffffffff enable=”true|false” idleTimeOut=”time”-Infinite logLevel=”logLevel”-Errors maxIoThreads=”number”-25 maxWorkerThreads=”number”-25 memoryLimit=”number” pingFrequency=”hh:mm:ss”-30 sec pingTimeout=”hh:mm:ss”-5 sec requestLimit=”number” requestQueueLimit=”number”-5000 responseDeadlockInterval=”infinite|hh:mm:ss”-3 min responseRestartDeadlockInterval=” infinite|hh:mm:ss”-9 min restartQueueLimit=”number”-10 serverErrorMessageFile=”filename” shudownTimeout=”time”-5 sec timeout=”time” webGarden=”true|false” username=”user name”-MACHINE password=”password”/>-autogenerate G)browserCaps:The element contains settings used by ASP.NET to provide the functionality of the browser capability component(accessible via the Request.Browser Property).It provides filtering processes that allow the browser capabilities component to populate its properties with information on the capabilities of a user’s browser, based on the information contained in the user agent string passed by the browser.The element supports 3 child elements, ,<use>,.The element supports one child element . <use var=”HTTP_USER_AGENT”/> property=value

Related Documents

Net2
June 2020 3
C#net2
November 2019 11
Billing Rhansoft-net2
November 2019 0