Como: Configurar um canal de forma programática
Este exemplo de código mostra como configurar um canal por meio de programação para um domínio de aplicativo do servidor. In this maiúscminúsc, the servidor is specifying that the sistema arquitetura de comunicação remota should use a objeto HttpChannel for Transportation but, use a objeto BinaryFormatter for serialização and desserialização.
Exemplo
Dim props = New Hashtable() As IDictionary
props("name") = "ChannelName1"
Dim channel As New HttpChannel( _
props, _
Nothing, _
New BinaryServerFormatterSinkProvider() _
)
ChannelServices.RegisterChannel(channel)
IDictionary props = new Hashtable();
props["name"] = "MyHttpChannel";
HttpChannel channel = new HttpChannel(
props,
null,
new BinaryServerFormatterSinkProvider()
);
ChannelServices.RegisterChannel(channel);