Programmatic Configuration
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

Programmatic Configuration 

Programmatic configuration is useful in some cases. Although configuration files can be helpful for quick redirection without recompiling your application, you can also directly configure your remote types in the hosting application domain and in the client application domain. The general requirements of configuration apply. The following code example shows a simple programmatic configuration of a listening application domain.

ChannelServices.RegisterChannel(new HttpChannel(1234));
WellKnownServiceTypeEntry WKSTE = new WellKnownServiceTypeEntry(typeof(ServiceClass),"HttpService", WellKnownObjectMode.SingleCall);
RemotingConfiguration.ApplicationName = "HttpService";

In more complex scenarios, such as programmatically publishing a particular instance of a remote object and then removing that object from publication, this type of configuration becomes a requirement. For more information, see Advanced Remoting and Remoting Example: Dynamic Publication.

See Also

© 2015 Microsoft