日期:2014-05-19  浏览次数:20775 次

关于remoting的事件使用问题?
使用remoting的事件代理,在客户端使用事件的时候出现异常:“
不允许类型   System.DelegateSerializationHolder   和从中派生的类型(例如   System.DelegateSerializationHolder)在此安全级别上被反序列化。”
不知道什么原因,好像是delegate不允许反序列化,该怎么解决?

------解决方案--------------------
在配置文件中将反序列化设置为 "FULL "
------解决方案--------------------
查一下MSDN。。。

------解决方案--------------------
在配置文件里面指定typeFilterLevel 为 Full
<formatter ref= "soap " typeFilterLevel=Full />

或者在代码里面:


BinaryServerFormatterSinkProvider provider = new BinaryServerFormatterSinkProvider();
provider.TypeFilterLevel = TypeFilterLevel.Full;
// Creating the IDictionary to set the port on the channel instance.
IDictionary props = new Hashtable();
props[ "port "] = 8085;
// Pass the properties for the port setting and the server provider in the server chain argument. (Client remains null here.)
TcpChannel chan = new TcpChannel(props, null, provider);

------解决方案--------------------
修改Remoting配置文件
Full:.NET 远程处理的完全反序列化级别。它在所有情况下都支持远程处理所支持的全部类型。
Low: .NET 远程处理的低反序列化级别。它支持与基本的远程处理功能相关联的类型。
<serverProviders>
<provider ref= "wsdl " />
<formatter ref= "soap " typeFilterLevel= "Full " />
<formatter ref= "binary " typeFilterLevel= "Full " />
</serverProviders>