I Use .NET 4.0 and using a class with ChannelSink, ServerSink and ClientSink. The program was created to deliver messages between 2 interfaces (remote and local). I have 4 kinds of messages.
3 of the Messages works fine (they dont contain DateTime data members).
I got a problem: In a specific kind of message (which DOES contain DateTime data members), whenever I try to deliver the message, the sink tries to deserialize the message - but fail with the following message:
ERROR:
Managed Debugging Assistant 'DateTimeInvalidLocalFormat' has detected a problem in 'C:\Program Files\IIS Express\iisexpress.exe'.
Additional information: A UTC DateTime is being converted to text in a format that is only correct for local times. This can happen when calling DateTime.ToString using the 'z' format specifier, which will include a local time zone offset in the output. In that case, either use the 'Z' format specifier, which designates a UTC time, or use the 'o' format string, which is the recommended way to persist a DateTime in text. This can also occur when passing a DateTime to be serialized by XmlConvert or DataSet. If using XmlConvert.ToString, pass in XmlDateTimeSerializationMode.RoundtripKind to serialize correctly. If using DataSet, set the DateTimeMode on the DataColumn object to DataSetDateTime.Utc.
Whenever I disable the Managed Debugging Assistant I receive this message:
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)
Which I guess has nothing to do with it, because the other 3 kinds of Messages work perfectly. Moreover, whenever I call the sink without delivering the message (just for a stub method) - it works. My question is, what to do? I try to add to the [XmlAttribute] tag the DataType="date" - but it didnt work.
help will be appreciated.