Is it possible to have a windows service be a host for remoting clients
and have the remoted object raise events to the clients?  If I remove the 
events, it runs without an error.  If I put the events
in, I get the exception listed below.  I tried giving both the service and
the client full trust and that didn't fix it.  What I'm trying to do is
have a windows service hold an object in memory to act as a broadcaster to
All clients that a client just added or deleted a record.


This is the class I would like to host in a windows service and raise the
events from

Public Class SomeObject
    Inherits System.MarshalByRefObject

    Public Event OnAdd(ByVal SomeTextHere As String)

    Public Event OnDelete(ByVal IDHere As Int32)

    Public Sub Add(ByVal Text As String)
        RaiseEvent OnAdd(Text)
    End Sub

    Public Sub Delete(ByVal ID As Int32)
        RaiseEvent OnDelete(ID)
    End Sub
End Class


This is the line that creates the exception

_obj = New ServerObject.SomeObject


This is the exception I get.


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.

Server stack trace:
   at
System.Runtime.Serialization.FormatterServices.CheckTypeSecurity(Type t,
TypeFilterLevel securityLevel)
   at
System.Runtime.Serialization.Formatters.Binary.ObjectReader.CheckSecurity(ParseRecord
pr)
   at
System.Runtime.Serialization.Formatters.Binary.ObjectReader.ParseObject(ParseRecord
pr)
   at
System.Runtime.Serialization.Formatters.Binary.ObjectReader.Parse(ParseRecord
pr)
   at
System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryObjectWithMapTyped
record)
   at
System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryHeaderEnum
binaryHeaderEnum)
   at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()
   at
System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler
handler, __BinaryParser serParser, Boolean fCheck, IMethodCallMessage
methodCallMessage)
   at
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream
serializationStream, HeaderHandler handler, Boolean fCheck,
IMethodCallMessage methodCallMessage)
   at
System.Runtime.Remoting.Channels.CoreChannel.DeserializeBinaryRequestMessage(String
objectUri, Stream inputStream, Boolean bStrictBinding, TypeFilterLevel
securityLevel)
   at
System.Runtime.Remoting.Channels.BinaryServerFormatterSink.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)
   at ServerObject.SomeObject.add_OnDelete(OnDeleteEventHandler obj)
   at TestServerEvents.Form1.set__obj(SomeObject WithEventsValue)
   at TestServerEvents.Form1.Form1_Load(Object sender, EventArgs e) in
C:\Data\Visual Studio Projects\TestServerEvents\Form1.vb:line 122

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to