다음을 통해 공유


Configuration

The .NET remoting infrastructure needs certain information in order to make remoting work smoothly. There are two ways to configure your remotable types: You can either call configuration methods directly in your server and client code (for details, see Programmatic Configuration), or you can create a remoting configuration section and include it in your application's configuration file, Web.config file, or Machine.config file (for details, see Remote Object Configuration). There are benefits and drawbacks to either configuration process, so your choice depends on your own preferences.

You must provide the following information to the remoting system to make your type remotable:

  • The type of activation required for your type.
  • The complete metadata describing your type.
  • The channel registered to handle requests for your type.
  • The URL that uniquely identifies the object of that type. In the case of server activation, this means a Uniform Resource Identifier (URI) that is unique to that type. In the case of client activation, a URL that is unique to that instance will be assigned.

Both the client and the server remoting infrastructure must know this information to create proxies for and dispatch method invocations to the remote server object. Clients might also have special configurations available to them. If your client application is requesting a client-activated object, the client can request that the lifetimes associated with the instance be extended. Finally, if your client is expecting a callback of some sort, the client itself must actively register a channel to listen for that callback. (In all other cases, the .NET remoting system automatically locates a compatible client channel, if the system has one.) Servers might specify default lifetime periods for client-activated objects, or specify that a particular custom object activator be used.

If you provide all information about the remotable object before trying to create an instance, you can use the new keyword (New in Visual Basic); otherwise, you must use either Activator.GetObject or Activator.CreateInstance.

Note   Although there are only a few settings in the preceding configuration file, most of the problems using .NET remoting occur because some of these settings are either incorrect or do not match the configuration settings for client applications. It is very easy to mistype a name, forget a port, or neglect an attribute. If you are having problems with your remoting application, check your configuration settings first.

See Also

.NET Remoting Overview | Metadata Issues | Activation URLs | Programmatic Configuration | Automatic Deserialization in .NET Remoting | Channel and Formatter Configuration Properties | Remoting Settings Schema | Hosting Remote Objects in Internet Information Services (IIS) | Remoting Example: Hosting in Internet Information Services (IIS)