C# System.Security.PermissionSet的远程处理(MarshallByRefObject)问题

C# System.Security.PermissionSet的远程处理(MarshallByRefObject)问题,c#,marshalbyrefobject,C#,Marshalbyrefobject,我有一个扩展MarshalByRefObject类的类。我创建了一个HTTPChannel,注册了ChannelService,在读取和写入int和string属性的同时,一切正常。我的通信类如下所示(请注意,这两个类只是一个示例,但我的实际项目看起来非常相似): 我的问题是在尝试设置MyClass[]属性时发生的异常。MyClass声明为: [Serializable] public class MyClass { public string StringValue {get; set

我有一个扩展MarshalByRefObject类的类。我创建了一个HTTPChannel,注册了ChannelService,在读取和写入int和string属性的同时,一切正常。我的通信类如下所示(请注意,这两个类只是一个示例,但我的实际项目看起来非常相似):

我的问题是在尝试设置MyClass[]属性时发生的异常。MyClass声明为:

[Serializable]
public class MyClass
{
    public string StringValue {get; set;}
}
我得到以下异常:System.Security.SecurityException:请求失败。堆栈跟踪显示:

The method that caused the failure
was:
System.Runtime.Remoting.Channels.ServerProcessing
ProcessMessage(System.Runtime.Remoting.Channels.IServerChannelSinkStack,
System.Runtime.Remoting.Messaging.IMessage,
System.Runtime.Remoting.Channels.ITransportHeaders,
System.IO.Stream,
System.Runtime.Remoting.Messaging.IMessage
ByRef,
System.Runtime.Remoting.Channels.ITransportHeaders
ByRef, System.IO.Stream ByRef)
显示的传统信息:

The action that failed was: Demand The
type of the first permission that
failed was:
System.Security.PermissionSet The
demand was for: <PermissionSet
class="System.Security.PermissionSet"
version="1" Unrestricted="true"/>

The only permitted permissions were:
<PermissionSet
class="System.Security.PermissionSet"
version="1"> <IPermission
class="System.Security.Permissions.SecurityPermission,
mscorlib, Version=4.0.0.0,
Culture=neutral,
PublicKeyToken=b77a5c561934e089"
version="1"
Flags="SerializationFormatter"/>
</PermissionSet>
失败的操作是:请求
指定的第一个权限的类型
失败的是:
System.Security.permission设置
需求是:
唯一允许的权限是:
谁能向我解释一下发生了什么事,我做错了什么?谢谢大家!


编辑:这只是我尝试设置MyClass的数组时出现的问题。我可以毫无问题地在MyCommunicationClass中分配属性MyClass属性。

您可以发布一个示例应用程序吗?我可以在客户端应用程序中设置从服务器获取的marshalbyref对象的项目数组,而无需发出“查看我的答案”命令
The action that failed was: Demand The
type of the first permission that
failed was:
System.Security.PermissionSet The
demand was for: <PermissionSet
class="System.Security.PermissionSet"
version="1" Unrestricted="true"/>

The only permitted permissions were:
<PermissionSet
class="System.Security.PermissionSet"
version="1"> <IPermission
class="System.Security.Permissions.SecurityPermission,
mscorlib, Version=4.0.0.0,
Culture=neutral,
PublicKeyToken=b77a5c561934e089"
version="1"
Flags="SerializationFormatter"/>
</PermissionSet>