BinaryFormatter Version incompatibility
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.remoting.

Post a new message to this list...

Lord2702
Thu. Sep. 09, 2004 3:10 PM PT

I try to host my MBRO on IIS Version 5.1, on WindowsXP Prof. and I get the
following exception. I also included my server web.config and client
configuration code. Anybody knows how to get rid off this exception ?

Thanks,

Server Config File: <web.config>---------- start ----------
<system.runtime.remoting>
<application>
<service>
<wellknown
mode="SingleCall" objectUri="NWind.rem"
type="CSDemo.NWind, NWind"/>
</service>
<channels>
<channel ref="http"/>
</channels>
</application>
<debug loadTypes="true" />
</system.runtime.remoting>

Server Config File: <web.config>---------- end ----------

Client Configuration ------------------- Start ------------------------

IChannel* channel = NULL;
BinaryClientFormatterSinkProvider *provClient = new
BinaryClientFormatterSinkProvider();
IDictionary *props = new Hashtable();
props->Item[S"port"] = __box(0);

channel = new HttpClientChannel(props, provClient);
ChannelServices::RegisterChannel(channel);

//get the object reference
m_NWind = RTryCast(INWind, Activator::GetObject(
__typeof(INWind), "http://localhost:80/NWind.rem";));

props = ChannelServices::GetChannelSinkProperties(m_NWind);
props->Item[S"credentials"] =
System::Net::CredentialCache::DefaultCredentials;

Client Configuration ------------------- End ------------------------

---Start---------------- Exception Info ----------: 9/9/2004 2:48:23 PM
Exception = System.Runtime.Serialization.SerializationException
Message = BinaryFormatter Version incompatibility. Expected Version 1.0.
Received Version 1835627630.1699884645.
Description = System.Runtime.Serialization.SerializationException:
BinaryFormatter Version incompatibility. Expected Version 1.0. Received
Version 1835627630.1699884645.
Server stack trace: at
System.Runtime.Serialization.Formatters.Binary.SerializationHeaderRecord.Rea
d(__BinaryParser input)
at
System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadSerializat
ionHeaderRecord()
at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()
at
System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(Head
erHandler handler, __BinaryParser serParser, Boolean fCheck,
IMethodCallMessage methodCallMessage)
at
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(S
tream serializationStream, HeaderHandler handler, Boolean fCheck,
IMethodCallMessage methodCallMessage)
at
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.UnsafeDeseria
lizeMethodResponse(Stream serializationStream, HeaderHandler handler,
IMethodCallMessage methodCallMessage)
at
System.Runtime.Remoting.Channels.CoreChannel.DeserializeBinaryResponseMessag
e(Stream inputStream, IMethodCallMessage reqMsg, Boolean bStrictBinding)
at
System.Runtime.Remoting.Channels.BinaryClientFormatterSink.DeserializeMessag
e(IMethodCallMessage mcm, ITransportHeaders headers, Stream stream)
at
System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessag
e(IMessage msg)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type)
at CSDemo.INWind.GetConnectionString()
at CSDemo.CSDemoApp.CheckBusinessObject() in
c:\projects\vsnet\mvc\csdemo\csdemoclient\csdemoapp.h:line 155
at CSDemo.CSDemoMainForm.CSDemoMainForm_Load(Object sender, EventArgs e)
in c:\projects\vsnet\mvc\csdemo\csdemoclient\csdemomainform.h:line 285
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.SendMessage(HandleRef hWnd,
Int32 msg, Int32 wParam, Int32 lParam)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.set_Visible(Boolean value)
at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason,
ApplicationContext context)
at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason,
ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationContext context)
at CSDemo.CSDemoApp.Run() in
c:\projects\vsnet\mvc\csdemo\csdemoclient\csdemoapp.h:line 102
at CSDemo.CSDemoApp.Run(ApplicationContext context) in
c:\projects\vsnet\mvc\csdemo\csdemoclient\csdemoapp.h:line 108
at WinMain(HINSTANCE__* hInstance, HINSTANCE__* hPrevInstance, SByte*
lpCmdLine, Int32 nCmdShow) in
c:\projects\vsnet\mvc\csdemo\csdemoclient\winappmain.cpp:line 16

CLR Version = 1.1.4322.573
OS Version = Microsoft Windows NT 5.1.2600.0
---End------------------------ Exception Info ----------

Reply to this message...
 
    
Sam Santiago
I have seen this error when you expect a binary formatted object returned
and your IIS server returns a standard HTTP error page. You're expecting a
binary formatted object, but instead you're getting back text, so an
exception is thrown. Usually this one:

An unhandled exception of type 'System.Runtime.Serialization.
SerializationException' occurred in mscorlib.dll

Additional information: BinaryFormatter Version incompatibility. Expected
Version 1.0. Received Version 1008738336.1684104552.

If you have network packet sniffer software you can see the actual returned
stream and see that it's not a binary formatted stream, but plain text. I
have used a great open source sniffer named Ethereal,
http://www.ethereal.com, that I highly recommend. It cannot trace local
traffic - localhost or your machine name, so in that scenario you might want
to use TcpTrace from PocketSoap, http://www.pocketsoap.com/tcptrace/.

Here's some sample output that I captured when this error occurred:

********** CALL To remoted object
POST /OrderServicesServer/RemoteActivationService.rem HTTP/1.1
User-Agent: Mozilla/4.0+(compatible; MSIE 6.0; Windows 5.1.2600.0; MS .NET
Remoting; MS .NET CLR 1.1.4322.573 )
Content-Type: application/octet-stream <<<------------ binary stream
Content-Length: 1146
Expect: 100-continue
Host: softitechture
HTTP/1.1 100 Continue
...................H.....Activate.}System.Runtime.Remoting.Activation.IActiva
tor, mscorlib, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089......................................4System
..Runtime.Remoting.Messaging.LogicalCallContext.........2System.Runtime.Remot
ing.Messaging.ConstructionCall.....__Uri.__MethodName.__MethodSignature
__TypeName.__Args
__CallContext.__CallSiteActivationAttributes.__ActivationType.__ContextPrope
rties.__Activator.__ActivationTypeName...........
System.Type[]4System.Runtime.Remoting.Messaging.LogicalCallContext.System.Co
llections.ArrayList8System.Runtime.Remoting.Activation.ContextLevelActivator
........ctor..........ePRA.BaseClasses.ApplicationFacade, BaseClasses,
Version=1.2.3.0, Culture=neutral, PublicKeyToken=null..........
..............................System.Type..........
.....System.Collections.ArrayList....._items._size._version......
.................8System.Runtime.Remoting.Activation.ContextLevelActivator...
...m_NextActivator.=System.Runtime.Remoting.Activation.ConstructionLevelActiv
ator......
........
.......=System.Runtime.Remoting.Activation.ConstructionLevelActivator.....
************************** Response - should have been a binary stream, but
was an HTML response
HTTP/1.1 500 Internal Server Error
Date: Fri, 13 Aug 2004 18:34:02 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
Cache-Control: private
Content-Type: text/html; charset=utf-8 <<<-----------------NOT binary, but
HTML
Content-Length: 3045
<html>
<head>
<title>Runtime Error</title>
<style>
.body {font-family:"Verdana";font-weight:normal;font-size:
..7em;color:black;}
.p
{font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
.b
{font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
.H1 {
font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
.H2 {
font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
.pre {font-family:"Lucida Console";font-size: .9em}
..marker {font-weight: bold; color: black;text-decoration: none;}
..version {color: gray;}
..error {margin-bottom: 10px;}
..expandable { text-decoration:underline; font-weight:bold;
color:navy; cursor:hand; }
</style>
</head>
<body bgcolor="white">
<span><H1>Server Error in '/OrderServicesServer' Application.<hr
width=100% size=1 color=silver></H1>
<h2> <i>Runtime Error</i> </h2></span>
<font face="Arial, Helvetica, Geneva, SunSans-Regular,
sans-serif ">
<b> Description: </b>An application error occurred on the
server. The current custom error settings for this application prevent the
details of the application error from being viewed remotely (for security
reasons). It could, however, be viewed by browsers running on the local
server machine.
<br><br>
<b>Details:</b> To enable the details of this specific error
message to be viewable on remote machines, please create a
<customErrors> tag within a "web.config" configuration file
located in the root directory of the current web application. This
<customErrors> tag should then have its "mode" attribute set
to "Off".<br><br>
<table width=100% bgcolor="#ffffcc">
<tr>
<td>
<code><pre>
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration></pre></code>
</td>
</tr>
</table>
<br>
<b>Notes:</b> The current error page you are seeing can be
replaced by a custom error page by modifying the "defaultRedirect"
attribute of the application's <customErrors> configuration tag to
point to a custom error page URL.<br><br>
<table width=100% bgcolor="#ffffcc">
<tr>
<td>
<code><pre>
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="RemoteOnly"
defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration></pre></code>
</td>
</tr>
</table>
<br>
</body>
</html>
*************************************

Thanks,

Sam

--
_______________________________
Sam Santiago
Click here to reveal e-mail address
http://www.SoftiTechture.com
_______________________________
"Lord2702" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Ken Kolda
This problem is occurring because your server is using the SoapFormatter and
your client is using the BinaryFormatter. Change your server's config file
to

<channel ref="http">
<serverProviders>
<formatter ref="soap"/>
</serverProvides>
</channel>

Ken

"Lord2702" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Ken Kolda
Whoops -- of course, that should have been:

<formatter ref="binary"/>

Ken

"Ken Kolda" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
> This problem is occurring because your server is using the SoapFormatter
and
[Original message clipped]

Reply to this message...
 
 
System.Collections.Hashtable
System.Collections.IDictionary
System.EventArgs
System.IntPtr
System.Net.CredentialCache
System.Runtime.InteropServices.HandleRef
System.Runtime.Remoting.Channels.BinaryClientFormatterSink
System.Runtime.Remoting.Channels.BinaryClientFormatterSinkProvider
System.Runtime.Remoting.Channels.ChannelServices
System.Runtime.Remoting.Channels.Http.HttpClientChannel
System.Runtime.Remoting.Channels.IChannel
System.Runtime.Remoting.Channels.ITransportHeaders
System.Runtime.Remoting.Messaging.CallContext
System.Runtime.Remoting.Messaging.HeaderHandler
System.Runtime.Remoting.Messaging.IMessage
System.Runtime.Remoting.Messaging.IMethodCallMessage
System.Runtime.Remoting.Proxies.RealProxy
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
System.Runtime.Serialization.Formatters.Soap.SoapFormatter
System.Runtime.Serialization.SerializationException
System.SByte
System.Type
System.Windows.Forms.Application
System.Windows.Forms.ApplicationContext
System.Windows.Forms.ContainerControl
System.Windows.Forms.Control
System.Windows.Forms.Form
System.Windows.Forms.NativeWindow
System.Windows.Forms.ScrollableControl




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com