remoting的问题,大家都来看看吧

colin666 2003-08-22 11:24:06
在remoting的调用时,调用远端函数时,传递的参数是一个继承了一个接口的usercontrol的实例,会出现一个serializationException的异常为“:由于安全限制,无法访问类型System.runtime.remoting.objref。但是我在.net2002里面没有这个问题,在2003里面才有这个问题,我想是不是2003在安全限制方面比2002更严格?请各位高手帮帮忙,谢谢!!
...全文
38 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
维她奶 2003-08-22
  • 打赏
  • 举报
回复
gz
myall2002 2003-08-22
  • 打赏
  • 举报
回复
.NET Remoting - Changes for .NET 1.1 / Visual Studio 2003
With the introduction of version 1.1 of the .NET Framework, a number of Remoting-related changes have been made. Most of them are focused at increasing security of .NET applications and I therefore consider them A Good Thing. Unfortunately though, they broke a number of samples in my books (and in all the other Remoting books out there).

If you use client activated objects, events or delegates you will quite likely encounter one of the following exceptions when running on the .NET Framework 1.1:

System.Security.SecurityException.
Type System.DelegateSerializationHolder and the types derived from it (such as System.DelegateSerializationHolder) are not permitted to be deserialized at this security level.
System.Runtime.Serialization.SerializationException
Because of security restrictions, the type System.Runtime.Remoting.ObjRef cannot be accessed.
To change the security level to allow passing of delegates and object references over Remoting boundaries, you have to change the so called "typeFilterLevel".

You can do this either by using a configuration file like this (for server side):

<configuration>
<system.runtime.remoting>
<channel ref="http" port="1234">
<serverProviders>
<provider ref="wsdl" />
<formatter ref="soap" typeFilterLevel="Full" />
<formatter ref="binary" typeFilterLevel="Full" />
</serverProviders>
<clientProviders>
<formatter ref="binary" />
</clientProviders>
</channel>
<service>
<!-- ... Add your services here ... -->
</service>
</system.runtime.remoting>
</configuration>
In this case, a matching client-side configuration file which allows the reception of events and callbacks, would look like this:

<configuration>
<system.runtime.remoting>
<channel ref="http" port="0">
<clientProviders>
<formatter ref="binary" />
</clientProviders>
<serverProviders>
<formatter ref="binary" typeFilterLevel="Full" />
</serverProviders>
</channel>
<client>
<!-- ... Add your classes here ... -->
</client>
</system.runtime.remoting>
</configuration>
If you prefer to setup your channels in source code, you have to use the extended constructor of the HttpChannel or TcpChannel to pass a custom IFormatterSinkProvider object:

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 );

myall2002 2003-08-22
  • 打赏
  • 举报
回复
http://www.ingorammer.com/RemotingFAQ/Changes2003.html
zhehui 2003-08-22
  • 打赏
  • 举报
回复

come here




http://groups.google.com/groups?hl=zh-CN&lr=&ie=UTF-8&oe=UTF-8&group=microsoft.public.dotnet.framework.remoting
TheAres 2003-08-22
  • 打赏
  • 举报
回复
try this one:

http://groups.google.com/groups?hl=zh-CN&lr=&ie=UTF-8&oe=UTF-8&threadm=2cce01c2b812%24938c9020%2489f82ecf%40TK2MSFTNGXA01&rnum=1&prev=/groups%3Fq%3DSystem.runtime.remoting.objref%2B2003%26hl%3Dzh-CN%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26selm%3D2cce01c2b812%2524938c9020%252489f82ecf%2540TK2MSFTNGXA01%26rnum%3D1

110,532

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧