The code below registers an HTTP Channel using binary.
IDictionary props = new Hashtable();
props["name"] = channelName;
props["port"] = portNumber;
BinaryServerFormatterSinkProvider serverProv = new
BinaryServerFormatterSinkProvider();
serverProv.TypeFilterLevel =
System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
BinaryClientFormatterSinkProvider clientProv = new
BinaryClientFormatterSinkProvider();
HttpChannel chnl = new HttpChannel(props, clientProv, serverProv);
ChannelServices.RegisterChannel(chnl);
--
- John
[quoted text, click to view] "Chaz" wrote:
> Ok we have .config files to specifiy the Remoting configuration, but I cant
> use them as the URL and potentially the formatting mode may change based on
> client requirements.
>
> I need to pull the settings from my own configuration data and apply code at
> runtime which has the same effect.
>
> I have found out how to create and register a channel;
>
> System.Runtime.Remoting.Channels.Http.HttpChannel mynewchannel
> = new System.Runtime.Remoting.Channels.Http.HttpChannel(9402);
>
> And to register the well known type;
>
> System.Runtime.Remoting.RemotingConfiguration.RegisterWellKnownServiceType(typeof(MyObj),"http://kkkkk",WellKnownObjectMode.SingleCall)
>
> But I cant find out how to tell the client to use the Binary Formatter for
> this channel ??
>
> Is there anyone that can anyone help ?
>
> Kindest Regards
>
> Chaz
>
>
Superb, thanks John
Although I did find that I had to omit the portNumber or I got an error
message stating that the port can only be used once and was in use, even if
I attempted to Unregister all existing channels?
By simply specifiying and registering a Binary Formatted HttpChannel it
seems to work and does appear to be formatting as binary
Thanks again
Chaz
[quoted text, click to view] "KidO" <KidO@community.nospam> wrote in message
news:B73DD17D-7E2A-4E56-9E19-E01118E38898@microsoft.com...
> The code below registers an HTTP Channel using binary.
>
> IDictionary props = new Hashtable();
> props["name"] = channelName;
> props["port"] = portNumber;
>
> BinaryServerFormatterSinkProvider serverProv = new
> BinaryServerFormatterSinkProvider();
> serverProv.TypeFilterLevel =
> System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
> BinaryClientFormatterSinkProvider clientProv = new
> BinaryClientFormatterSinkProvider();
>
> HttpChannel chnl = new HttpChannel(props, clientProv, serverProv);
>
> ChannelServices.RegisterChannel(chnl);
>
> --
> - John
>
>
> "Chaz" wrote:
>
>> Ok we have .config files to specifiy the Remoting configuration, but I
>> cant
>> use them as the URL and potentially the formatting mode may change based
>> on
>> client requirements.
>>
>> I need to pull the settings from my own configuration data and apply code
>> at
>> runtime which has the same effect.
>>
>> I have found out how to create and register a channel;
>>
>> System.Runtime.Remoting.Channels.Http.HttpChannel mynewchannel
>> = new System.Runtime.Remoting.Channels.Http.HttpChannel(9402);
>>
>> And to register the well known type;
>>
>> System.Runtime.Remoting.RemotingConfiguration.RegisterWellKnownServiceType(typeof(MyObj),"http://kkkkk",WellKnownObjectMode.SingleCall)
>>
>> But I cant find out how to tell the client to use the Binary Formatter
>> for
>> this channel ??
>>
>> Is there anyone that can anyone help ?
>>
>> Kindest Regards
>>
>> Chaz
>>
>>
>>