PermissionSet中 - 请求失败的错误错误、PermissionSet

2023-09-03 06:53:16 作者:淡若清风

我有几个项目使用ChannelSink,ServerSink和ClientSink沟通。

I have few projects communicating using ChannelSink, ServerSink and ClientSink.

我已经升级,从.NET 2.0的项目.NET 4.0。升级前一切正常。

I've upgraded the projects from .NET 2.0 to .NET 4.0. Before the upgrade everything worked fine.

现在,当我尝试沟通, - 为特定的消息 - 我OnReceiveMessage不叫,并抛出以下异常:

Now, when I try to communicate , - for a specific message - my OnReceiveMessage isn't called and throwing the following exception:

System.Security.SecurityException:请求失败

System.Security.SecurityException: Request failed

服务器堆栈跟踪:       在System.Array.InternalCreate(void *的元素类型,等级的Int32,的Int32 * pLengths,的Int32 *

Server stack trace: at System.Array.InternalCreate(Void* elementType, Int32 rank, Int32* pLengths, Int32*

pLowerBounds)       在System.Array.CreateInstance(类型元素类型,长度的Int32)       在System.Runtime.Serialization.Formatters.Soap.ObjectReader.ParseArray(ParseRecord   PR)       在System.Runtime.Serialization.Formatters.Soap.ObjectReader.ParseObject(ParseRecord   PR)       在System.Runtime.Serialization.Formatters.Soap.ObjectReader.Parse(ParseRecord   PR)   System.Runtime.Serialization.Formatters.Soap.SoapHandler.StartChildren()       在System.Runtime.Serialization.Formatters.Soap.SoapParser.ParseXML()   System.Runtime.Serialization.Formatters.Soap.ObjectReader.Run()   System.Runtime.Serialization.Formatters.Soap.ObjectReader.Deserialize(HeaderHandler,   ISerParser

pLowerBounds) at System.Array.CreateInstance(Type elementType, Int32 Length) at System.Runtime.Serialization.Formatters.Soap.ObjectReader.ParseArray(ParseRecord pr) at System.Runtime.Serialization.Formatters.Soap.ObjectReader.ParseObject(ParseRecord pr) at System.Runtime.Serialization.Formatters.Soap.ObjectReader.Parse(ParseRecord pr) System.Runtime.Serialization.Formatters.Soap.SoapHandler.StartChildren() at System.Runtime.Serialization.Formatters.Soap.SoapParser.ParseXML() System.Runtime.Serialization.Formatters.Soap.ObjectReader.Run() System.Runtime.Serialization.Formatters.Soap.ObjectReader.Deserialize(HeaderHandler, ISerParser

serParser)   System.Runtime.Serialization.Formatters.Soap.SoapFormatter.Deserialize(流   serializationStream,

serParser) System.Runtime.Serialization.Formatters.Soap.SoapFormatter.Deserialize(Stream serializationStream,

HeaderHandler处理)       在System.Runtime.Remoting.Channels.CoreChannel.DeserializeSoa prequestMessage(流

HeaderHandler handler) at System.Runtime.Remoting.Channels.CoreChannel.DeserializeSoapRequestMessage(Stream

的InputStream,标题[]小时,布尔bStrictBinding)       在System.Runtime.Remoting.Chanels.SoapServerFormatterSink.ProcessMessage

inputStream, Header[] h, Boolean bStrictBinding) at System.Runtime.Remoting.Chanels.SoapServerFormatterSink.ProcessMessage

(IServerChannelSinkStack sinkStack,即时聊天requestMsg,   ITransportHeaders requestHeaders,流

(IServerChannelSinkStack sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, Stream

requestStream,即时聊天和放大器; responseMsg,ITransportHeaders和放大器;   responseHeaders响应,流和放大器; responseStream)

requestStream, IMessage& responseMsg, ITransportHeaders& responseHeaders, Stream& responseStream)

例外重新抛出的[0]       在System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(即时聊天reqMsg,即时聊天

Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage (IMessage reqMsg, IMessage

retMSg)       在System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&安培;   MSGDATA,的Int32型)       。       。 (我的一些文件)       。失败的行动是:需求失败是第一个许可的类型:System.Security.PermissionSet的需求   对于:

retMSg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) . . (some of my files) . The action that failed was: Demand The type of the first permission that failed was: System.Security.PermissionSet The demand was for:

唯一允许的权限为:

这导致了故障的方法是:   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 method that caused that 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)

的事情是,如果我创建一个虚拟的方法,并把它添加到sinkstack - 它调用它。即使我使用相同的代理否认此消息。

The thing is, if I create a dummy method and add it to the sinkstack - it calls it. even if I use the same proxy which denies the message.

另一件事是,其他消息都工作得很好。只有一种类型的消息的心不是所有iv'e创建的类型的工作。

Other thing is, The other messages are working just fine. only one type of messages isnt working from all the types iv'e created.

我没有要求的PermissionSet在我的应用程序在所有,任何帮助?

I haven't requested PermissionSet at my app at all, Any help?

推荐答案

呸 - 应该有猜测,张贴在堆栈交换机5分钟后,我会找到它。我只是不得不更换:

Pah - should have guess that 5 minutes after posting on stack exchange I would find it. I simply had to replace:

<formatter ref="soap" />

<formatter ref="soap" typeFilterLevel="Full" />

MSDN文档typeFilterLevel解释发生了什么,但我不完全知道为什么数组不被认为是基本型

The MSDN documentation for typeFilterLevel explains what's happening, although I'm not entirely sure why an array isn't considered a "basic" type