I have built a remote object which is held by IIS, and I have a client calling the remote object with parameter inherited from MarshalByRef.
It work fine when I was using .Net Framework 1.0.
However, I have upgraded the Machine to .Net Framework 1.1. I found that the remote object can no longer work wells.
I realized that the .Net Framework 1.1 has changed the default deserialization level to Low. Later, I found that I someone said it can change the config file for setting the deserialization level to Full, which may works in my suitation.
Then I have changed the Web.config to the following.
**********
**********
and I have changed the client code in creating the remote object as follow,
**********
SoapServerFormatterSinkProvider serverProv = new SoapServerFormatterSinkProvider();
serverProv.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
SoapClientFormatterSinkProvider clientProv = new SoapClientFormatterSinkProvider();
System.Collections.IDictionary props = new System.Collections.Hashtable();
props["port"] = 0;
HttpChannel httpChannel = new HttpChannel( props, clientProv, serverProv );
ChannelServices.RegisterChannel( httpChannel );
_interface = ( Interface ) Activator.GetObject( typeof( Interface ),
"http://192.1.1.192/RemoteObject/RemoteObject.rem");
**********
It still throw the same exception with the following message,
"Because of security restrictions, the type System.Runtime.Remoting.ObjRef cannot be accessed."
However, if I try to host the Remote Object in a Console Program with the following code,
**********
SoapServerFormatterSinkProvider serverProv = new SoapServerFormatterSinkProvider();
serverProv.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
System.Collections.IDictionary props = new System.Collections.Hashtable();
props["port"] = 8080;
HttpChannel httpChannel = new HttpChannel(props, null, serverProv);
ChannelServices.RegisterChannel( httpChannel );
RemotingConfiguration.RegisterWellKnownServiceType(
typeof( myObject.Remote ),
"RemoteObject",
WellKnownObjectMode.SingleCall );
**********
and the Client is the same except the url is,
**********
"http://192.1.1.192:8080/RemoteObject"
**********
Everythings work fine.
Can anyone help me in this problem?