共用方式為


Activation

There are two types of activation for marshal-by-reference objects:

  • Server activation.

    Server-activated objects are created by the server only when they are needed. They are not created when the client proxy is created by calling new or Activator.GetObject, but rather when the client invokes the first method on that proxy. For details, see Server Activation.

    You use the the WellKnownObjectMode enumeration to configure server-activated objects as Singleton or SingleCall objects. Singleton objects are objects for which there will always be only one instance, regardless of how many clients there are for that object, and which have a default lifetime. (The client can use the lifetime lease system to participate in the lifetime of Singleton instances. For details, see Lifetime Leases.) When you configure an object to be a SingleCall object, the system creates a new object for each client method invocation. Because a client will get a reference to a new instance on each invocation, SingleCall types do not participate in the lifetime lease system.

  • Client activation.

    Client-activated objects are created on the server when the client calls new or Activator.CreateInstance. The client itself, using the lifetime lease system, can participate in the lifetime of these instances. For details, see Client Activation and Lifetime Leases.

See Also

Object Activation and Lifetimes | Remotable Objects | Server Activation | Client Activation