这是Framework1.1新加入的安全特性,限制可以自动Deserialize的类型。一种解决办法是在配置文件中,设置typeFilterLevel="Full"。另一种是在程序中设定对应的属性:
BinaryServerFormatterSinkProvider serverProv = new BinaryServerFormatterSinkProvider();
provider.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;BinaryClientFormatterSinkProvider clientProv = new BinaryClientFormatterSinkProvider();IDictionary props = new Hashtable();
props["port"] = 1234;HttpChannel chan = new HttpChannel(props, clientProv, provider);        
ChannelServices.RegisterChannel( chan );