Serialization and .NET Framework 1.1 |
|
Contents
- SYMPTOMS
- CAUSE
- RESOLUTION
SYMPTOMS
When passing serializable objects (this includes .NET object references) as parameters under .NET Framework 1.1 to a .NET server application, you may get the error as reported by J-Integra for .NET:
com.intrinsyc.janet.RemoteException: Server threw an exception: ****
System.Runtime.Serialization.SerializationException - Insufficient state to deserialize the object. More information is needed.
or com.intrinsyc.janet.RemoteException: Server threw an exception: ****
System.Runtime.Serialization.SerializationException - Because of security restrictions, the type SimpleRemoting.Stock cannot be accessed.
CAUSE
As of .NET Framework 1.1 (v1.1.4322), Microsoft has introduced secure serialization in .NET Remoting. This is because any remoting system that relies on run-time type validation must deserialize a remote stream to begin using it, and malicious clients could use the moment of serialization or deserialization to the detriment of your application. A new attribute, typeFilterLevel was introduced and must be set in the configuration file. See Backwards Breaking Changes from version 1.0 to 1.1 for more details.
RESOLUTION
On the .NET server side, you'll need to change your remoting configuration file to add the following XML (if you are hosting in IIS or Component Services, the configuration file is named web.config. For example, if the channel you are registering for the server to listen on looked like this:
<channel port="5656" ref="tcp"/>
then change to: <channel port="5656" ref="tcp">
<serverProviders>
<provider ref="wsdl"/>
<!-- For binary format -->
<formatter ref="binary" typeFilterLevel="Full"/>
<!-- For soap format -->
<formatter ref="soap" typeFilterLevel="Full"/>
</serverProviders>
</channel>
The typeFilterLevel attribute is not recognized under .NET Framework 1.0 (v1.0.3705) and you will get an exception if you try to run your application with this attribute under .NET Framework 1.0.
Status
This is a Microsoft issue and requires no changes to the J-Integra for .NET runtime.