Re: How to Pass Object to Server?
- From: "Nicolas Bouchard" <nicolas.bouchard@xxxxxxxxx>
- Date: 3 May 2006 07:48:45 -0700
Hi,
The solution may be easy enough, in the .NET Framework 1.1 the default
security for the remoting was changed (I don't know, or atleast I don't
remember, the reason why).
To fix the problem, you have to set the type filter level in both side
of your remoting.
provider.TypeFilterLevel = TypeFilterLevel.Full;
Here is an example how to declare it using the code.
// Creating a custom formatter for a TcpChannel sink chain.
BinaryServerFormatterSinkProvider provider = new
BinaryServerFormatterSinkProvider();
provider.TypeFilterLevel = TypeFilterLevel.Full; // ** here
is the interesting line
// Creating the IDictionary to set the port on the channel
instance.
IDictionary props = new Hashtable();
props["port"] = 2134;
// Pass the properties for the port setting and the server
provider in the server chain argument. (Client remains null here.)
TcpChannel chan = new TcpChannel(props, null, provider);
ChannelServices.RegisterChannel(chan);
RemotingConfiguration.RegisterWellKnownServiceType(
typeof(RemotingService),
"RemotingService.rem",
WellKnownObjectMode.Singleton);
If you are using the config file to configure your remoting, here is an
example for the client, the server side will be the same pattern.
<system.runtime.remoting>
<application name="Messenger.exe">
<channels>
<channel ref="tcp" port="0">
<serverProviders>
<provider ref="wsdl"/>
<formatter ref="soap" typeFilterLevel="Full"/>
<formatter ref="binary" typeFilterLevel="Full"/>
</serverProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>
Here is an example of my server config file :
<system.runtime.remoting>
<customErrors mode="off" />
<application>
<service>
<wellknown mode="SingleCall" displayName="Database object"
type="MessengerManager.DBMessengerWrapper, MessengerManager"
objectUri="DBMessenger.rem" />
<wellknown mode="SingleCall" displayName="Converter object"
type="MessengerManager.ConverterWrapper, MessengerManager"
objectUri="Converter.rem" />
<wellknown mode="SingleCall" displayName="Server manager
object" type="MessengerManager.ServerControl, MessengerManager"
objectUri="ServerControl.rem" />
</service>
<channels>
<channel ref="tcp" port="65200">
<serverProviders>
<provider ref="wsdl"/>
<formatter ref="soap" typeFilterLevel="Full"/>
<formatter ref="binary" typeFilterLevel="Full"/>
</serverProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>
I hope that will fix your problem!
Nicolas
.
- Prev by Date: Re: Debug Remotable Object
- Next by Date: Re: Debug Remotable Object
- Previous by thread: IE hosted windows user controls causes IE to crash
- Next by thread: Stop server thread from client
- Index(es):
Relevant Pages
|
Loading