.Net remoting error "The input stream is not a valid binary format."

I have a .Net remoting application, that often reports System.Runtime.Serialization.SerializationException "The input stream is not a valid binary format. The starting contents (in bytes) are: xx-xx-xx ..."

There area few threads  about this error(e.g .Re: Error passing a large variable as a parameter to a remote method  and Remoting / Serialization problem trying to Migrate to .NET 2.0 )

As it is correctly noted in the posts,  IIS sends back an error message as plain text that the binary formatter doesn't know how to handle.

In other words, unhandled exception on remoting server causes  (De)SerializationException on the client.

As an example, when I've made a mistake in web.config on remoting server, IIS sent the error to the client, but client just show hexadecimal starting content.

 If the content would be shown as text as well, it will be easy to recognize the problem. 

The good policy will be not allow to throw exception through remoting server boundary and catch them,log and return some indicator (e.g. null,false, exception as a parameter etc) to client.  Unfortunately someproblemslike invalid web.config willbe reported before your code (with try/catch) will be invoked.

I am going to try A custom channel sink to fix the HttpChannel/BinaryFormatter/ASP.NET host bug.

posted @ Wednesday, April 18, 2007 11:27 PM

Print

Comments on this entry:

# re: .Net remoting error "The input stream is not a valid binary format."

Left by EvanK at 4/19/2007 12:50 AM
Gravatar
I've ran into this problem before...it was because we were remoting from 2.0 to the 1.1 framework. Something about a difference in the date time fields I believe. There is a hotfix available from Microsoft.

# re: .Net remoting error "The input stream is not a valid binary format."

Left by Michael Freidgeim at 4/19/2007 1:47 AM
Gravatar
EvanK,
I beleive that the problem with different versions of frameworks caused unhandled on server exception,which ended with this generic SerializationException on client.

# re: .Net remoting error "The input stream is not a valid binary format."

Left by DavidM at 5/13/2008 7:58 PM
Gravatar
I got this same error when my remoting tier was stopped. You would never guess from the error message, but its worth checking that your remote IIS, app pool etc are all running!

Your comment:



 (will not be displayed)


 
 
 
Please add 5 and 3 and type the answer here:
 

Live Comment Preview:

 
«October»
SunMonTueWedThuFriSat
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678