.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 using A custom channel sink to fix the HttpChannel/BinaryFormatter/ASP.NET host bug and it helps.

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!

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

Left by mkd at 3/19/2009 2:06 AM
Gravatar
Just changing the ASP.NET version to 2.0 in the ASP.NET tab of the default website will help.

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

Left by Michael Freidgeim at 3/19/2009 9:24 PM
Gravatar
mkd,
ASP.NET version mismatch is one of possible reasons for html response from IIS host. Other often errors are incorrect web.config in services web site or timeouts. By installing custom channel sink you will see the error details in plain English.

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

Left by Pranoti at 8/6/2009 1:04 AM
Gravatar
thers no ASP.NET version mismatch in my case...

Your comment:



 (will not be displayed)


 
 
 
 
 

Live Comment Preview:

 
«November»
SunMonTueWedThuFriSat
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345