serializing/deserializing with remoting

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jeff

    #1

    serializing/deserializing with remoting

    I am using .NET remoting with a class,call it MyClass, that
    contains many other classes (say one of them is
    MySubClass). I have been able to successfully call
    functions from the MyClass, but when I try to access the
    sub-classes it gives me a:
    System.Runtime. Serialization.S erializationExc eption
    "The constructor to deserialze an object of type
    MyClass.MySubCl ass was not found."

    error. I do have the '[Serializable]' modifier preceeding
    the MyClass defn. and preceeding the other subclasses as well.
    Also I have included an extra line for MySubClass in my
    server.exe.conf ig:

    <service>
    <wellknown
    type="MyNameSpa ce.MyClass,MyAs semblyName"
    objectUri = "MyClass.so ap"
    mode="Singleton "
    />
    <wellknown type="MyNameSpa ce.MyClass.MySu bClass,MyAssemb lyName"
    objectUri = "MyClass/MySubClass.soap "
    mode="Singleton "
    />
    </service>

    as well as the corresponding lines in the client.exe.conf ig.
    What is the serialization/deserialization process for remoting?
    What am I missing?

    Cheers,

    Jeff.
  • Rob Teixeira [MVP]

    #2
    Re: serializing/deserializing with remoting

    Chances are that one of your objects implements the ISerializable interface
    (or inherits from a class that does). This typically happens on type-safe
    collections.
    That being the case, you need to include the deserialization constructor on
    that class (check the help docs for the exact signature of the constructor)
    and call the base deserialization constructor from there. Remember that
    constructors on the base object aren't propegated to the derived object in
    inheritance.

    -Rob [MVP]

    "jeff" <j.mcphail@comc ast.net> wrote in message
    news:0e0801c351 26$5bfb5170$a30 1280a@phx.gbl.. .[color=blue]
    > I am using .NET remoting with a class,call it MyClass, that
    > contains many other classes (say one of them is
    > MySubClass). I have been able to successfully call
    > functions from the MyClass, but when I try to access the
    > sub-classes it gives me a:
    > System.Runtime. Serialization.S erializationExc eption
    > "The constructor to deserialze an object of type
    > MyClass.MySubCl ass was not found."
    >
    > error. I do have the '[Serializable]' modifier preceeding
    > the MyClass defn. and preceeding the other subclasses as well.
    > Also I have included an extra line for MySubClass in my
    > server.exe.conf ig:
    >
    > <service>
    > <wellknown
    > type="MyNameSpa ce.MyClass,MyAs semblyName"
    > objectUri = "MyClass.so ap"
    > mode="Singleton "
    > />
    > <wellknown type="MyNameSpa ce.MyClass.MySu bClass,MyAssemb lyName"
    > objectUri = "MyClass/MySubClass.soap "
    > mode="Singleton "
    > />
    > </service>
    >
    > as well as the corresponding lines in the client.exe.conf ig.
    > What is the serialization/deserialization process for remoting?
    > What am I missing?
    >
    > Cheers,
    >
    > Jeff.[/color]


    Comment

    Working...