Geeks With Blogs

News My Blog has been MOVED to https://mfreidge.wordpress.com
Michael Freidgeim's OLD Blog My Blog has been MOVED to https://mfreidge.wordpress.com

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 on Wednesday, April 18, 2007 11:27 PM .Net Remoting | Back to top


Comments on this post: .Net remoting error "The input stream is not a valid binary format."

# re: .Net remoting error "The input stream is not a valid binary format."
Requesting 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.
Left by EvanK on Apr 19, 2007 12:50 AM

# re: .Net remoting error "The input stream is not a valid binary format."
Requesting 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.
Left by Michael Freidgeim on Apr 19, 2007 1:47 AM

# re: .Net remoting error "The input stream is not a valid binary format."
Requesting 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!
Left by DavidM on May 13, 2008 7:58 PM

# re: .Net remoting error "The input stream is not a valid binary format."
Requesting Gravatar...
Just changing the ASP.NET version to 2.0 in the ASP.NET tab of the default website will help.
Left by mkd on Mar 19, 2009 2:06 AM

# re: .Net remoting error "The input stream is not a valid binary format."
Requesting 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.
Left by Michael Freidgeim on Mar 19, 2009 9:24 PM

# re: .Net remoting error "The input stream is not a valid binary format."
Requesting Gravatar...
thers no ASP.NET version mismatch in my case...
Left by Pranoti on Aug 06, 2009 1:04 AM

# re: .Net remoting error "The input stream is not a valid binary format."
Requesting Gravatar...
That is ok. But what about sending text file with substring "System.Runtime.Serialization.SerializationException". You'll got exception. Is'nt it?
Left by Dmitry Batalov on Jun 29, 2010 3:02 AM

# re: .Net remoting error "The input stream is not a valid binary format."
Requesting Gravatar...
hi,
where can I download the sink source code from?
thanks,
Left by nazim on Jun 09, 2012 1:23 AM

# re: .Net remoting error "The input stream is not a valid binary format."
Requesting Gravatar...
Nazim,
Try to contact Richard Blewett http://www.thinktecture.com/staff/richard
Left by Michael.freidgeim on Jun 10, 2012 5:49 PM

# re: .Net remoting error "The input stream is not a valid binary format."
Requesting Gravatar...
Where can i download the custom sink now , pages are taken down :( if you have it can you pass the source code.

Thank You,
Pradeep
Left by Pradeep on May 08, 2017 4:29 PM

# re: .Net remoting error "The input stream is not a valid binary format."
Requesting Gravatar...
Try to ask Richard Blewett at http://www.dotnetconsult.co.uk/weblog2/
Left by Michael freidgeim on May 10, 2017 7:29 AM

Your comment:
 (will show your gravatar)


Copyright © Michael Freidgeim | Powered by: GeeksWithBlogs.net