Condividi tramite


BinaryFormatter Version incompatibility

When hosted in IIS / Asp.Net and using the binary formatter you might run into an exception saying

"BinaryFormatter Version incompatibility. Expected Version 1.0. Received Version 1950887522.2017816692".

The issue here is that under various error conditions IIS may send back a HTML response which the binary formatter cannot deserialize. The workaround is to switch to using the soap formatter on the client to get the response in a more readable form. In v2.0 of the framework the exception message would be a little better saying that the formatter was unable to deserialize from the stream which is better than the cryptic version mismatch message.