View Full Version : Remoting Events
choenes
10-26-2005, 08:55 PM
I am brand new to Remoting and playing with the Spring.Examples.Calculator sample and tried added an event "MemoryCleared" to the ICalculator interface and got a security exception when I tried to hook to the event.
"Additional information: Type System.DelegateSerializationHolder and the types derived from it (such as System.DelegateSerializationHolder) are not permitted to be deserialized at this security level."
Is this possible?
Mark Pollack
10-29-2005, 01:56 AM
Hi,
Yea - it is possible. I gather you implemented the eventing much like you would if you were not using .NET remoting. There are a handful of issues in this approach - Ingo Rammer's book Advanced .NET Remoting (http://shrinkster.com/8z5) covers the issues and is worth a read.
To overcome the issue you describe you need to tell the client and server channel to relax security. The config files would then read for the client
<channels>
<channel ref="tcp" >
<serverProviders>
<formatter ref="binary" typeFilterLevel="Full" />
</serverProviders>
</channel>
</channels>
and for the server
<channels>
<channel ref="tcp" port="8005" >
<serverProviders>
<formatter ref="binary" typeFilterLevel="Full"/>
</serverProviders>
</channel>
</channels>
However, then you will run into the issue that the server will not be able to properly deserialize the method you registered since it is contained in the client's assembly and the server doesn't have access to it. There are work arounds for this, then work arounds for dealing with unreachable clients, calling clients in a seperate thread etc. These issues can be all be patched up with enough work (or so I've heard) but one would really like this low level stuff to be handled by the middleware out of the box. As such is it no surprise that rule #6 in Rammer's Remoting FAQ (http://www.thinktecture.com/Resources/RemotingFAQ/RemotingUseCases.html) is "Do not use events, callbacks and client-side sponsors".
If you are interested in enterprise messaging, look at message oriented middleware like MSMQ or Tibco. I know some people who have been happy using custom .NET Remoting channel implementations provided by Genuine Channels (http://www.genuinechannels.com/) but I don't have direct firsthand experience with that product.
Cheers,
Mark
choenes
10-31-2005, 05:01 AM
Yea I did some more reading about it and found exactly what you've posted. It's upsetting that it seems like we have to go to third party solutions for everything and the .net framework just doesn't handle it correctly.
I think we'll try to do without eventing for now. Genuine Channels is very intriguing. Thanks for the advice.
Mark Pollack
10-31-2005, 01:18 PM
Hi,
My pleasure. If you eventually need messaging, Microsoft's MSMQ maybe a cost effective option if it meets your requirements.
Cheers,
Mark
vBulletin® v3.7.3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.