问题
I have few projects communicating using ChannelSink, ServerSink and ClientSink.
I've upgraded the projects from .NET 2.0 to .NET 4.0. Before the upgrade everything worked fine.
Now, when I try to communicate , - for a specific message - my OnReceiveMessage isn't called and throwing the following exception:
System.Security.SecurityException: Request failed
Server stack trace: at System.Array.InternalCreate(Void* elementType, Int32 rank, Int32* pLengths, Int32*
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(Stream serializationStream,
HeaderHandler handler) at System.Runtime.Remoting.Channels.CoreChannel.DeserializeSoapRequestMessage(Stream
inputStream, Header[] h, Boolean bStrictBinding) at System.Runtime.Remoting.Chanels.SoapServerFormatterSink.ProcessMessage
(IServerChannelSinkStack sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, Stream
requestStream, IMessage& responseMsg, ITransportHeaders& responseHeaders, Stream& responseStream)
Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage (IMessage reqMsg, IMessage
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:
The only permitted permissions were:
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)
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.
Other thing is, The other messages are working just fine. only one type of messages isnt working from all the types iv'e created.
I haven't requested PermissionSet at my app at all, Any help?
回答1:
Pah - should have guess that 5 minutes after posting on stack exchange I would find it. I simply had to replace:
<formatter ref="soap" />
by
<formatter ref="soap" typeFilterLevel="Full" />
The MSDN documentation for typeFilterLevel explains what's happening, although I'm not entirely sure why an array isn't considered a "basic" type
来源:https://stackoverflow.com/questions/21888291/permissionset-request-failed-error