strange exception with command object

strange exception with command object

Old forum URL: forums.lhotka.net/forums/t/2034.aspx


andy posted on Wednesday, December 27, 2006

I am using the command object to run Interop object on my remote server.

Occassionally I got the exception below:

System.Runtime.Serialization.SerializationException: The input stream is not a valid binary format. The starting contents (in bytes) are: 3C-68-74-6D-6C-3E-0D-0A-20-20-20-20-3C-68-65-61-64 ...

Server stack trace:

at System.Runtime.Serialization.Formatters.Binary.SerializationHeaderRecord.Read(__BinaryParser input)

at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadSerializationHeaderRecord()

at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()

at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)

at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)

at System.Runtime.Remoting.Channels.CoreChannel.DeserializeBinaryResponseMessage(Stream inputStream, IMethodCallMessage reqMsg, Boolean bStrictBinding)

at System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage(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 Csla.Server.IDataPortalServer.Update(Object obj, DataPortalContext context)

at Csla.DataPortalClient.RemotingProxy.Update(Object obj, DataPortalContext context)

at Csla.DataPortal.Update(Object obj)

at Csla.DataPortal.Update[T](T obj)

at Csla.DataPortal.Execute[T](T obj)

at BusinessServerTier.Workorder.Workorder.DoLoad(String shipvoy)

at YMAmerica.Workorder.frmWorkorder.worker_DoWork(Object sender, DoWorkEventArgs e)

at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)

at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)

 

Any comment or suggestion how to resolve this issue?

Andy

ajj3085 replied on Wednesday, December 27, 2006

It sounds like you're hitting a problem where the Principal object is not serializable and the thread has switched appdomains (which will be the case if you're remoting host is Cassini; use IIS instead).

OR.. there could be an assembly version mismatch.

The easiest thing to do would be to try to open the remoting host with Internet explorer, as you're probably getting HTML back instead of a binary object.

andy replied on Wednesday, December 27, 2006

Thank you for quick reply.

I am hosting in IIS running Windows 2K3 using CSLA 2.1

I am not quite sure if it's related to assembly version mismatch, as the problem happens sporadically.

For your suggestion, I don't know how to go about tracing the error via IE. 

I just wonder if it has anything to do with timeout session.

I do notice only happened for a long running process session.

Andy

ajj3085 replied on Wednesday, December 27, 2006

Well your command object shouldn't be relying on getting the same IIS session, so hopefully you aren't doing that.

Basically you open IE and give it the same url that you used when configuring remoting.  There's also a tool out there, and unfortunately I can't remember the name at the moment, but you launch it and it listens for HTTP traffic between IE and the server, and can save the raw HTML headers out.  Hopefully someone knows what I'm talking about..

Andy

andy replied on Wednesday, December 27, 2006

I am suppose getting the same IIS session if I am hosting inside IIS.

I am using the same Interop object with my asp.net app and it's working perfectly fine.

Using the same web.config configuration session as follow:

<sessionState

mode="StateServer"

stateConnectionString="tcpip=localhost:42424"

timeout="60"/>

 

 

xal replied on Thursday, December 28, 2006

This usually happens due to timeouts or when the serialized object is bigger than the default max length.

In your web.config, create a <httpRuntime> node inside <system.web>. Set maxRequestLength (in KB) and executionTimeout (in seconds) to whatever suits your needs for httpRuntime.

I hope it helps.


Andrés

JoeFallon1 replied on Thursday, December 28, 2006

The tool you are looking for is called Fiddler.

 

Copyright (c) Marimer LLC