Building a Host Application 

By itself, the RemotableType class defined in the How To: Build a Remotable Type topic is not special. To enable objects in other application domains to create instances of this object remotely, you must build a host or listener application to do two things:

  • Choose and register a channel, which is an object that handles the networking protocols and serialization formats on your behalf.

  • Register your type with the .NET remoting system so that it can use your channel to listen for requests for your type.

The .NET Framework includes two default channels, HttpChannel (which uses SOAP formatting) and TcpChannel (which uses binary formatting). HttpChannel is a good channel to start with because in some scenarios, it can be used through firewalls without opening a port, and it supports standard security and authentication protocols. For more information about choosing channels that suit your scenario, see Channels.

You can build listener applications using any type of application domain — a Windows Forms application, an ASP.NET Web application, a console application, a Windows Service (also known as a Windows NT Service), or any other managed application domain. Because remote configuration is done on a per-application-domain basis, the application domain must be running to listen for requests.

Note

Unlike COM, remoting does not start the host or server application for you. This is an important difference between .NET remoting and remote activation in COM.

Configuration can be done programmatically or by using an application or machine configuration file.

The remoting system uses the information in this file to listen for and route remote requests to an instance of a remotable type. The file specifies the Singleton server-activation mode, the type name and assembly of the type on behalf of which it is to listen, and the object Uniform Resource Identifier (URI) or external name of the object. (For more details about object URIs and remoting, see Activation URLs.) The file also tells the remoting system to listen for requests on port 8989 using the system-provided HttpChannel.

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 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

Tasks

How to: Build a Hosting Application

Reference

Remoting Settings Schema
WellKnownObjectMode.Singleton

Concepts

Configuration of Remote Applications
Server Activation

Other Resources

Building a Basic .NET Framework Remoting Application