BinaryFormatter.Deserialize fails when used with .net ActiveX

G

Guest

Hi All,
I have an annoying trouble with binary serialization. I have a windows
forms application which works like a server and keeps sending data to its
clients. The data is serialized before being sent using BinaryFormatter and a
serializable object. When using a windows forms application as a client,
everything works just fine and deserialized data can be received intact. When
the client application is is embedded in Internet Explorer (I call it .net
ActiveX), the received data can not be deserialized correctly and I get the
following error:

System.Runtime.Serialization.SerializationException
BinaryFormatter Version incompatibility. Expected Version 1.0. Received
Version 130568.285739008

Note that I'm using exactly the same code I use with the windows forms
application but, the result is completely different. I checked the
serializable object version deployed on the web server and the serializable
object used at the sending point, both are the same. I tried to write the
bytes received to a file stream and it looked normal to me. If someone of you
can help me, I will be very thankful.

Regards
 
G

Guest

This problem occures when IIS returns a error page. Which is of course not
binary formatted. So on recieving the error page your deserializer throws an
error.

You may check the config file, there should be. binary not soap.
<formatter ref="binary"/>

Hope this helps
 
G

Guest

Thanks for your fast response.
Unfortunately, this could not help in my case. This may help someone using
remoting through ASP.NET. This is not the situation here. The application I'm
using is Windows Forms application which runs on an HTML page. I suspected
the encoding of strings so, I removed them from my serializable object but,
still getting the same problem.

Regards
 
G

Guest

I discovered that before the Version incompatibility exception is thrown,
the BinaryFormatter can not find the serializable object assembly. I made
sure a thousand times that assembely of the serializable object is in the
same location as the web page and in its bin directory. I also made sure all
references are set. Also note that, I have other assemblies referenced by the
activex and they are working just fine. How can I tell the engine that I
really have the assembly deployed?

Regards
 
C

Collin Bennett

You are in a sandbox when deploying your application using (HTTP
No-Touch Deployment). I think you have to double check the path where
you are trying to deserialize/load the file from.
 
G

Guest

I'm not loading assembly manually. It's loaded on behalf of BinaryFormatter
and I have no control on where it loads file from. All binary files all
deployed to web server root directory. All assemblies get loaded successfully
but, the one being loaded by the BinaryFormatter does not get loaded
successfully.

Regards
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top