RemotingException is thrown when .NET Remoting receives a binary formatted custom message
This article resolves RemotingException that the sending application receives when Microsoft .NET Remoting receives a binary formatted custom message.
Original product version: Microsoft .NET Framework 4.5
Original KB number: 2935795
Symptoms
Consider the following scenario:
- You use Microsoft .NET Remoting to establish communication between applications.
- You use binary format to serialize the messages.
- An application sends a custom message type that's derived from the
MarshalByRefObject
object.
In this scenario, the sending application receives a RemotingException
exception. This exception contains a NotSupportedException
inner exception and the link https://go.microsoft.com/fwlink/?linkid=390633
.
Cause
This issue occurs because .NET Remoting rejects custom messages that are derived from the MarshalByRefObject
when you use binary format. This is default behavior for the following versions of the Microsoft .NET Framework:
- .NET Framework 1.1
- .NET Framework 2.0
- .NET Framework 3.0
- .NET Framework 3.5
- .NET Framework 4.0
- .NET Framework 4.5
Workaround
To configure .NET Remoting in order to accept custom MarshalByRefObject
messages, follow these steps:
- When you call
ChannelServices.RegisterChannel()
function, set theensureSecurity
argument totrue
. This makes sure that your remoting channel is secure. - Set the value of
microsoft:Remoting:AllowTransparentProxyMessage
key totrue
in the Web.config file or App.config file of the application that receives this custom message, as in the following example:
<configuration>
<appSettings>
<add key="microsoft:Remoting:AllowTransparentProxyMessage" value="true"/>
</appSettings>
</configuration>
Note
If this <appSettings>
configuration is absent or if it contains a value other than true
, .NET Remoting will use the default behavior and throw a RemotingException
when this kind of message is received.