Share via


How to: Specify a Channel in a Configuration File

This topic is specific to a legacy technology that is retained for backward compatibility with existing applications and is not recommended for new development. Distributed applications should now be developed using the Windows Communication Foundation (WCF).

Because the Listener.exe.config and Client.exe.config files contain all the configuration information necessary to make a remote connection, you can change the channel without recompiling your application merely by changing the channel specified in the configuration file.

To change the channel specified in the configuration file

  • Change the channel to a TcpChannel object, which uses binary serialization by default, by changing the <wellknown> element in the Client.exe.config file to the following:

    <wellknown 
       type="RemotableType, RemotableType"
       url="tcp://localhost:8989/RemotableType.rem"
    />
    
NoteNote

You can specify the machine name instead of localhost, if the remote type is available on another machine.

  1. Change the <channel> element in the Listener.exe.config file to the following:

    <channel ref="tcp" port="8989"/>
    
  2. Rerun the application according to the preceding execution instructions. You do not need to recompile the application.

See Also

Tasks

How to: Compile and Run a Basic Remoting Application

Other Resources

Building a Basic .NET Framework Remoting Application