Re: Deserialization exception when using MarshalByRef object with events

From: Ken Kolda (ken.kolda_at_elliemae-nospamplease.com)
Date: 10/27/04


Date: Wed, 27 Oct 2004 12:07:26 -0700

In your server's config file you have the <serverProviders> element outside
of the <channel> element. It should be inside (as you have it in yoyur
client's config file).

        <channel ref="tcp" port="4000">
           <serverProviders>
               <formatter ref="binary" typeFilterLevel="Full" />
          </serverProviders>
        </channel>

Ken

"Shannon Cayze" <scayze@us.loreal.com> wrote in message
news:f9c7c737.0410271050.71e5971a@posting.google.com...
> Hello all,
>
> I'm getting the following exception on the client when attempting to
> assign a delegate to a MarshalByRefObject's event on the server:
>
> "An unhandled exception of type 'System.Security.SecurityException'
> occurred in mscorlib.dll
>
> 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."
>
> I saw all sorts of documentation telling me to change the
> typeFilterLevel to full, either in a .config file or in code. I've
> tried it both ways and it still doesn't work. Here are the key parts
> of code from the server, client, MarshalByRef object, and .config
> files:
>
> ***************** Server code **************************
>
> public class Server
> {
> .
> .
> public void Start()
> {
> RemotingConfiguration.Configure("Server.exe.config");
> }
> .
> .
> }
>
> ***************** Client code **************************
>
> public class Client
> {
> .
> .
> public void Start()
> {
> RemotingConfiguration.Configure("Client.exe.config");
> Bomb bomb = new Bomb();
> bomb.BombDetonated += new BombHandler(BombDetonated);
> bomb.Detonate();
> }
>
> private void BombDetonated(Bomb bomb)
> {
> Console.WriteLine("Bomb Detonated");
> }
> .
> .
> }
>
> ***************** MarshalByRefObject code **************************
>
> public class Bomb : MarshalByRefObject
> {
> public delegate void BombHandler(Bomb bomb);
> public event BombHandler BombDetonated;
> public event BombHandler BombDiffused;
>
> public void Detonate() {...}
> public void Diffuse() {...}
> }
>
>
> ***************** Server.exe.config **************************
>
> <configuration>
> <system.runtime.remoting>
> <application>
> <channels>
> <channel ref="Tcp" port="4000" />
> <serverProviders>
> <formatter ref="binary" typeFilterLevel="Full" />
> </serverProviders>
> </channels>
>
> <service>
> <wellknown mode="Singleton" type="SharedObjects.Bomb,
> SharedObjects"
> objectUri="Bomb.rem" />
> </service>
> </application>
> </system.runtime.remoting>
> </configuration>
>
> ***************** Client.exe.config **************************
>
> <configuration>
> <system.runtime.remoting>
> <application>
>
> <channels>
> <channel ref="tcp" port="0">
> <clientProviders>
> <formatter ref="binary" />
> </clientProviders>
> <serverProviders>
> <formatter ref="binary" typeFilterLevel="Full" />
> </serverProviders>
> </channel>
> </channels>
>
> <client>
> <wellknown type="SharedObjects.Bomb, SharedObjects"
> url="Tcp://localhost:4000/Bomb.rem" />
> </client>
>
> </application>
> </system.runtime.remoting>
> </configuration>
>
> *********************************************************
>
> Also, if I start the program without debugging, part of the exception
> refers to the Microsoft .Net security policy and altering it. Can
> anyone tell me what I'm doing wrong? I've seen many threads where
> people have gotten it to work, so I know it's possible, but I think
> I'm missing something small.
>
> Thanks in advance,
> Shannon



Relevant Pages

  • Re: How can server interrupt client in browser?
    ... The rationale here is not to use up a TCP/IP connection and a server ... private static MessageThread socketThread; ... public void shutdown() ... the browser client is single threaded. ...
    (comp.lang.javascript)
  • Re: DOCSIS vulnerability
    ... Sure, you can get a config file onto the modem, but if ... the router will not allow the cable modem to finish booting (With some kind ... > items, a syslog server, a tftp server, a time server, and a config file to ... > rate limit their customers, it's how they keep their customers ...
    (Vuln-Dev)
  • Re: Socket problems
    ... I'm trying to write a 20 client chat server which is not ... >> public void listenFromClients() ... > // create a new communicator task and pass it the socket ...
    (comp.lang.java.programmer)
  • Re: Better way to manage DNS
    ... parser that would inturn set options on a w2k/w3k server and export the ... Justin has been working on a parser for the config file and general ... > Microsoft MVP (Windows Server System: ...
    (microsoft.public.windows.server.dns)
  • Remoting Error
    ... can the server application call methods of the shared Object?? ... public RemDeskBridge rdb; ... The procedure on client side is:- ... public void setUP ...
    (microsoft.public.dotnet.languages.csharp)