首页 新闻 会员 周边 捐助

按引用将对象封送到远程服务器

0
悬赏园豆:80 [已关闭问题] 关闭于 2009-08-20 16:01

http://support.microsoft.com/kb/307600/zh-cn

哪位高手来帮看一下.这个例子我按了弄一下。总在这里提示错误objHelloServer.HelloMethod(objForwardMe):由于安全限制,无法访问类型 System.Runtime.Remoting.ObjRef。怎么解决?

451114258的主页 451114258 | 初学一级 | 园豆:1
提问于:2009-08-19 21:58
< >
分享
所有回答(1)
0

好像是配置文件的问题。

见下面链接   http://www.codeproject.com/KB/XML/remotingsimpleeng.aspx


A. Oh yes... You would need to consider some things when using this code in v1.1 of the framework... You need to add a property called typeFilterLevel to the formatter tag and set it to Full to relax security, or else, you'll get an exception:

Collapse
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.

Be sure to change your config file (on the server):

Collapse
<configuration>
<system.runtime.remoting>
<channel ref="http" port="7777">
<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>

and client:

Collapse
<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>

For more details on how to do it programmatically, please refer to this link.

eaglet | 园豆:17139 (专家六级) | 2009-08-20 09:06
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册