[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.remoting

Server to Client is Fine Client to Server is SerializationException

Lord2702

8/25/2004 5:10:00 AM

Tue. Aug. 24, 2004 10:10 PM PT

I have a remoting server, SingleCall, on which I am hosting a COM+ Business
Object Component, Now when I am getting an Object/ Class, which is marked by
Serializable Attribute, also, using Custom serialization with ISerializable
interface, with protected: Constructor, and GetObjectData method. This
object is derived from MarshalByRefObject. Because, I only want to serialize
this on client and then server side.

Without applying any security permission I get this object passed correctly,
from server to client, and client receives it correctly.

Now, I want to pass it from client to Server, but I get
SerializationException, that security is not permitted. I apply the Security
attribute as follows:

[SecurityPermissionAttribute(SecurityAction::Demand,SerializationFormatter=t
rue)]

But still I am getting the same exception ? Why ? or anything more I have to
do, like instead using protected: constructor, do I have to use
SetObjectData, and mark this method with security attribute. Anyhow, I want
to send this object from Client to Server.

Any idea.

Thanks in advance.


4 Answers

Ken Kolda

8/25/2004 3:08:00 PM

0

Have you set the typeFilterLevel = Full on both client and server's
formatter sinks? See:

http://blogs.msdn.com/sanpil/archive/2004/02/23/...

Ken


"Lord2702" <Lord2702@MSN.com> wrote in message
news:uhSZJHmiEHA.1644@tk2msftngp13.phx.gbl...
> Tue. Aug. 24, 2004 10:10 PM PT
>
> I have a remoting server, SingleCall, on which I am hosting a COM+
Business
> Object Component, Now when I am getting an Object/ Class, which is marked
by
> Serializable Attribute, also, using Custom serialization with
ISerializable
> interface, with protected: Constructor, and GetObjectData method. This
> object is derived from MarshalByRefObject. Because, I only want to
serialize
> this on client and then server side.
>
> Without applying any security permission I get this object passed
correctly,
> from server to client, and client receives it correctly.
>
> Now, I want to pass it from client to Server, but I get
> SerializationException, that security is not permitted. I apply the
Security
> attribute as follows:
>
>
[SecurityPermissionAttribute(SecurityAction::Demand,SerializationFormatter=t
> rue)]
>
> But still I am getting the same exception ? Why ? or anything more I have
to
> do, like instead using protected: constructor, do I have to use
> SetObjectData, and mark this method with security attribute. Anyhow, I
want
> to send this object from Client to Server.
>
> Any idea.
>
> Thanks in advance.
>
>


Lord2702

8/26/2004 4:56:00 AM

0

Wed. Aug. 25, 2004, 9:55 PM PT

Ken,

Although, your solution works great for me, and Thank you very much, but,
the same is not working for Http channel, although, I want to use Binary
formatter for http. But when I set it the given solution, for Tcp it is
working fine, but for Http, it throws an exception while loading Business
Object on client side, whereas server works fine. Exception is:
ArgumentNullException.
Message: No message was deserialized prior to calling the
DispatchChannelSink.
Parameter name: requestMsg

Even I try to set typeFilterLevel to Low for Http channel, but since it is
default, it is not working.

I am not using, and don't want to use, config. file, but rather
programmatically configuring the server, and client configurations.

Thanks and apreciate your help.

"Ken Kolda" <ken.kolda@elliemae-nospamplease.com> wrote in message
news:e14V%23VriEHA.1356@TK2MSFTNGP09.phx.gbl...
> Have you set the typeFilterLevel = Full on both client and server's
> formatter sinks? See:
>
> http://blogs.msdn.com/sanpil/archive/2004/02/23/...
>
> Ken
>
>
> "Lord2702" <Lord2702@MSN.com> wrote in message
> news:uhSZJHmiEHA.1644@tk2msftngp13.phx.gbl...
> > Tue. Aug. 24, 2004 10:10 PM PT
> >
> > I have a remoting server, SingleCall, on which I am hosting a COM+
> Business
> > Object Component, Now when I am getting an Object/ Class, which is
marked
> by
> > Serializable Attribute, also, using Custom serialization with
> ISerializable
> > interface, with protected: Constructor, and GetObjectData method. This
> > object is derived from MarshalByRefObject. Because, I only want to
> serialize
> > this on client and then server side.
> >
> > Without applying any security permission I get this object passed
> correctly,
> > from server to client, and client receives it correctly.
> >
> > Now, I want to pass it from client to Server, but I get
> > SerializationException, that security is not permitted. I apply the
> Security
> > attribute as follows:
> >
> >
>
[SecurityPermissionAttribute(SecurityAction::Demand,SerializationFormatter=t
> > rue)]
> >
> > But still I am getting the same exception ? Why ? or anything more I
have
> to
> > do, like instead using protected: constructor, do I have to use
> > SetObjectData, and mark this method with security attribute. Anyhow, I
> want
> > to send this object from Client to Server.
> >
> > Any idea.
> >
> > Thanks in advance.
> >
> >
>
>


Sam Santiago

8/26/2004 5:09:00 AM

0

Here's an example of configuring HTTP channels programmatically:

Client Side:

Dim clientProv As BinaryClientFormatterSinkProvider
Dim serverProv As BinaryServerFormatterSinkProvider = New
BinaryServerFormatterSinkProvider
serverProv.TypeFilterLevel =
System.Runtime.Serialization.Formatters.TypeFilterLevel.Full
clientProv = New BinaryClientFormatterSinkProvider
Dim props As IDictionary = New Hashtable
props("port") = 0
Dim chan As HttpChannel = New HttpChannel(props, clientProv, serverProv)
ChannelServices.RegisterChannel(chan)

Server Side:

Dim clientProv As BinaryClientFormatterSinkProvider
Dim serverProv As BinaryServerFormatterSinkProvider = New
BinaryServerFormatterSinkProviderserverProv.TypeFilterLevel =
System.Runtime.Serialization.Formatters.TypeFilterLevel.Full
clientProv = New BinaryClientFormatterSinkProvider
Dim props As IDictionary = New Hashtable
props("port") = 8085
Dim chan As HttpChannel = New HttpChannel(props, clientProv, serverProv)
ChannelServices.RegisterChannel(chan)


Thanks,

Sam

--
_______________________________
Sam Santiago
ssantiago@n0spam-SoftiTechture.com
http://www.SoftiTe...
_______________________________
"Lord2702" <Lord2702@MSN.com> wrote in message
news:u$NGHkyiEHA.2764@TK2MSFTNGP11.phx.gbl...
> Wed. Aug. 25, 2004, 9:55 PM PT
>
> Ken,
>
> Although, your solution works great for me, and Thank you very much, but,
> the same is not working for Http channel, although, I want to use Binary
> formatter for http. But when I set it the given solution, for Tcp it is
> working fine, but for Http, it throws an exception while loading Business
> Object on client side, whereas server works fine. Exception is:
> ArgumentNullException.
> Message: No message was deserialized prior to calling the
> DispatchChannelSink.
> Parameter name: requestMsg
>
> Even I try to set typeFilterLevel to Low for Http channel, but since it is
> default, it is not working.
>
> I am not using, and don't want to use, config. file, but rather
> programmatically configuring the server, and client configurations.
>
> Thanks and apreciate your help.
>
> "Ken Kolda" <ken.kolda@elliemae-nospamplease.com> wrote in message
> news:e14V%23VriEHA.1356@TK2MSFTNGP09.phx.gbl...
> > Have you set the typeFilterLevel = Full on both client and server's
> > formatter sinks? See:
> >
> > http://blogs.msdn.com/sanpil/archive/2004/02/23/...
> >
> > Ken
> >
> >
> > "Lord2702" <Lord2702@MSN.com> wrote in message
> > news:uhSZJHmiEHA.1644@tk2msftngp13.phx.gbl...
> > > Tue. Aug. 24, 2004 10:10 PM PT
> > >
> > > I have a remoting server, SingleCall, on which I am hosting a COM+
> > Business
> > > Object Component, Now when I am getting an Object/ Class, which is
> marked
> > by
> > > Serializable Attribute, also, using Custom serialization with
> > ISerializable
> > > interface, with protected: Constructor, and GetObjectData method. This
> > > object is derived from MarshalByRefObject. Because, I only want to
> > serialize
> > > this on client and then server side.
> > >
> > > Without applying any security permission I get this object passed
> > correctly,
> > > from server to client, and client receives it correctly.
> > >
> > > Now, I want to pass it from client to Server, but I get
> > > SerializationException, that security is not permitted. I apply the
> > Security
> > > attribute as follows:
> > >
> > >
> >
>
[SecurityPermissionAttribute(SecurityAction::Demand,SerializationFormatter=t
> > > rue)]
> > >
> > > But still I am getting the same exception ? Why ? or anything more I
> have
> > to
> > > do, like instead using protected: constructor, do I have to use
> > > SetObjectData, and mark this method with security attribute. Anyhow, I
> > want
> > > to send this object from Client to Server.
> > >
> > > Any idea.
> > >
> > > Thanks in advance.
> > >
> > >
> >
> >
>
>


Lord2702

8/26/2004 5:52:00 AM

0

Wed. Aug. 25, 2004 10:50 PM PT

Millions, Trillions, Zillions Thanks to Both, ken, and Sam. It works. One
more thank, to Sam, for answering my problem SO quickly, and I was just
waiting for the answer, I tried and it works. Thanks.

"Sam Santiago" <ssantiago@n0spam-SoftiTechture.com> wrote in message
news:%23QP07qyiEHA.3016@tk2msftngp13.phx.gbl...
> Here's an example of configuring HTTP channels programmatically:
>
> Client Side:
>
> Dim clientProv As BinaryClientFormatterSinkProvider
> Dim serverProv As BinaryServerFormatterSinkProvider = New
> BinaryServerFormatterSinkProvider
> serverProv.TypeFilterLevel =
> System.Runtime.Serialization.Formatters.TypeFilterLevel.Full
> clientProv = New BinaryClientFormatterSinkProvider
> Dim props As IDictionary = New Hashtable
> props("port") = 0
> Dim chan As HttpChannel = New HttpChannel(props, clientProv, serverProv)
> ChannelServices.RegisterChannel(chan)
>
> Server Side:
>
> Dim clientProv As BinaryClientFormatterSinkProvider
> Dim serverProv As BinaryServerFormatterSinkProvider = New
> BinaryServerFormatterSinkProviderserverProv.TypeFilterLevel =
> System.Runtime.Serialization.Formatters.TypeFilterLevel.Full
> clientProv = New BinaryClientFormatterSinkProvider
> Dim props As IDictionary = New Hashtable
> props("port") = 8085
> Dim chan As HttpChannel = New HttpChannel(props, clientProv, serverProv)
> ChannelServices.RegisterChannel(chan)
>
>
> Thanks,
>
> Sam
>
> --
> _______________________________
> Sam Santiago
> ssantiago@n0spam-SoftiTechture.com
> http://www.SoftiTe...
> _______________________________
> "Lord2702" <Lord2702@MSN.com> wrote in message
> news:u$NGHkyiEHA.2764@TK2MSFTNGP11.phx.gbl...
> > Wed. Aug. 25, 2004, 9:55 PM PT
> >
> > Ken,
> >
> > Although, your solution works great for me, and Thank you very much,
but,
> > the same is not working for Http channel, although, I want to use Binary
> > formatter for http. But when I set it the given solution, for Tcp it is
> > working fine, but for Http, it throws an exception while loading
Business
> > Object on client side, whereas server works fine. Exception is:
> > ArgumentNullException.
> > Message: No message was deserialized prior to calling the
> > DispatchChannelSink.
> > Parameter name: requestMsg
> >
> > Even I try to set typeFilterLevel to Low for Http channel, but since it
is
> > default, it is not working.
> >
> > I am not using, and don't want to use, config. file, but rather
> > programmatically configuring the server, and client configurations.
> >
> > Thanks and apreciate your help.
> >
> > "Ken Kolda" <ken.kolda@elliemae-nospamplease.com> wrote in message
> > news:e14V%23VriEHA.1356@TK2MSFTNGP09.phx.gbl...
> > > Have you set the typeFilterLevel = Full on both client and server's
> > > formatter sinks? See:
> > >
> > > http://blogs.msdn.com/sanpil/archive/2004/02/23/...
> > >
> > > Ken
> > >
> > >
> > > "Lord2702" <Lord2702@MSN.com> wrote in message
> > > news:uhSZJHmiEHA.1644@tk2msftngp13.phx.gbl...
> > > > Tue. Aug. 24, 2004 10:10 PM PT
> > > >
> > > > I have a remoting server, SingleCall, on which I am hosting a COM+
> > > Business
> > > > Object Component, Now when I am getting an Object/ Class, which is
> > marked
> > > by
> > > > Serializable Attribute, also, using Custom serialization with
> > > ISerializable
> > > > interface, with protected: Constructor, and GetObjectData method.
This
> > > > object is derived from MarshalByRefObject. Because, I only want to
> > > serialize
> > > > this on client and then server side.
> > > >
> > > > Without applying any security permission I get this object passed
> > > correctly,
> > > > from server to client, and client receives it correctly.
> > > >
> > > > Now, I want to pass it from client to Server, but I get
> > > > SerializationException, that security is not permitted. I apply the
> > > Security
> > > > attribute as follows:
> > > >
> > > >
> > >
> >
>
[SecurityPermissionAttribute(SecurityAction::Demand,SerializationFormatter=t
> > > > rue)]
> > > >
> > > > But still I am getting the same exception ? Why ? or anything more I
> > have
> > > to
> > > > do, like instead using protected: constructor, do I have to use
> > > > SetObjectData, and mark this method with security attribute. Anyhow,
I
> > > want
> > > > to send this object from Client to Server.
> > > >
> > > > Any idea.
> > > >
> > > > Thanks in advance.
> > > >
> > > >
> > >
> > >
> >
> >
>
>