共用方式為


Server-Side Registration 

Server-activated or client-activated objects are normally registered in the Web.config file when they are hosted through Internet Information Services (IIS), or in the application configuration file when the objects are hosted directly. Place all objects that the application hosts inside the <service> element.

When publishing server-activated (<wellknown>) objects, you must indicate whether the object is a SingleCall or Singleton object, the type of the object, and the endpoint where the object can be accessed. When publishing client-activated (<activated>) objects, you must indicate only the type of the object.

Configuring Server-Activated Types With IIS

If you intend to host your remote service in Internet Information Services to take advantage of the benefits IIS provides, there are some slight changes you must make to your configuration file. You can use the Web.config file to configure IIS to handle requests for your type automatically, or you can use the Application_Start handler in the Global.asax file to load your configuration file using RemotingConfiguration.Configure and passing the name of your configuration file. In either case:

  • Do not specify an application name using the name attribute of the <application> tag. The virtual directory you create to host your remotable type will be the application name to clients of your type.

  • Do not specify a port using the port attribute of a <channel> tag inside an <application> tag. If IIS creates a new thread to serve an increased number of requests, a new channel might be created, but an exception will be thrown because that port is already in use by the original channel. Instead, specify the port to use in Internet Services Manager. .NET remoting services will handle any requests for your remotable type on that port.

See Also

Tasks

How to: Register a Server-Activated Object and a Client-Activated Object for a Host Application Domain

Reference

System.Runtime.Remoting.RemotingConfiguration Class

Concepts

Configuration of Remote Applications
Remote Object Configuration

Other Resources

Registering Remote Objects Using Configuration Files
.NET Framework Remoting Overview