Thursday, December 23, 2004

Really obscure remoting error

I ran into the oddest error message today and thought I'd post the problem and solution up here. I was deploying our product on a test machine I have here at home which is a single processor P3 with Win2k3 Enterprise Edition loaded on it. The app's server piece runs under an ASP.NET remoting host and uses the binary formatter. No brainer really. Usually the typical error messages have to do with security, impersonation, database user, etc. Today I get this RETARDED message when running the client:

Exception Information
-------------------------------------------
Exception Type: System.ArgumentOutOfRangeException
Message: Ticks must be between DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks. Parameter name: ticks
ActualValue: NULL
ParamName: ticks
TargetSite: Void HandleReturnMessage(System.Runtime.Remoting.Messaging.IMessage, System.Runtime.Remoting.Messaging.IMessage)
HelpLink: NULL
Source: mscorlib

StackTrace Information
-------------------------------------------

Server stack trace:
  at System.DateTime..ctor(Int64 ticks)
  at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadDateTime()
  at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadValue(InternalPrimitiveTypeE code)
  at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadMemberPrimitiveUnTyped()
  at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()
  at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, IMethodCallMessage methodCallMessage)
  at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, 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)

Ummmm.... WTF!? Okay. Calm down. Ask Google what the problem is... it'll be okay. Well after asking Google groups I found a bunch of messages regarding the Process object... Definitely not related to anything I'm doing. I was just doing a simple remote method call... I wasn't even passing a DateTime value anywhere. This is bad. What do I do? I decided to try and delete the Temporary ASP.NET files so I look under the v1.1.4322 folder and guess what? I don't see the temp files' folder for my app! Hmmmmm.... So I have a look-see under the v2.0.40607 folder. There it is! Well that's not right!

It turns out the version of ASP.NET it was running under was incorrect. I opened up the virtual directory's property sheet and on the ASP.NET tab, sure enough, the version was set to 2.0. I switched it to 1.1 and everything worked like a charm. Looks like Win2k3 defaults to ASP.NET 2.0 when creating the virtual directory.

Update: The reason why my Win2k3 test server was defaulting to version 2.0 is because I have Whidbey loaded on that machine.

2 comments:

Beth Massi said...

I'm not sure if it's a Whidbey error, I figured it's because I was trying to run 1.1 compiled code under 2.0. Though, running under 1.0 works. And yes I know I'm a dork but I did mention this was a test server :-P

Anonymous said...

that's the nice thing about remoting errors - you can almost always count on them to lead you down the wrong path ;-). That's definitely a nice catch on your part though.

Bill