Serialization exception (.net framework 1.1)

If you recently moved your code base from .net 1.0 to .net 1.1 and are
getting one of the following errors when trying to use a Client
Activated Object then you are having a problem with the typeFilterLevel.


System.Security.SecurityException or System.Runtime.Serialization.SerializationException

This is caused by increased security Microsoft implemented in the newer
.net1.1 framework.  To get around this problem you simply need to
set your typeFilterLevel="Full".


// In Source Code
BinaryServerFormatterSinkProvider tpfProvider =
  new BinaryServerFormatterSinkProvider();
tpfProvider.TypeFilterLevel = TypeFilterLevel.Full;
BinaryClientFormatterSinkProvider clientProv =
  new BinaryClientFormatterSinkProvider();
IDictionary props = new Hashtable();
props["port"] = 8675;
TcpChannel channel =
  new TcpChannel( props, clientProvider, tpfprovider );

ChannelServices.RegisterChannel( channel );
// In configuration file
<formatter ref="binary" typeFilterLevel="Full" />   



Share this article!

Follow us!

Find more helpful articles: