http://support.microsoft.com/kb/307600/zh-cn
哪位高手来帮看一下.这个例子我按了弄一下。总在这里提示错误objHelloServer.HelloMethod(objForwardMe):由于安全限制,无法访问类型 System.Runtime.Remoting.ObjRef。怎么解决?
好像是配置文件的问题。
见下面链接 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:
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):
<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:
<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.