The application is a standard .net remoting application, the .net remoting application has been in the .net platform for almost 7 years. The server side is running on IIS 32 bit process which hosted a Lot of Well-known singlecall/singleton remote objects.
When one end user startup the Client application on Windows 7 /XP 64 bit, one weird bug said It can’t access some configuraton ( the config should be for Server side only, Now the logic is executed in client, why? Is there something wrong with the .net remoting runtime? ) then I spend hours to make sure both client and server side have applied the latest update. NO luck, still get the error which is caused by Some server side logic been executed on client side.
the logic code looks like this
[Serializable] public class RemoteObject : MarshalByRefObject { static RemoteObject() { //try to read some server side configuration, web.config config= System.Configuration.ConfigurationSettings.AppSettings["serversideconfig"].Trim(); System.Console.WriteLine("Static Constructor Method of MBR is executed on Process " + Process.GetCurrentProcess().ProcessName); } |
Why the static method get executed on Client, It should be on server side only. Client is just a wrapper. then I write a mini demo, to identify the pattern. and it’s pretty easy to reproduce the issue. basically, it is caused by the 64 bit CLR. ( samething for .net framework 2.0/3.0/4.0)
Server 32 Bit | Server 64 Bit | |
Client 32bit | Server Execution Only | Server Execution Only |
Client 64bit | Client/Server Both Execution | Client/Server Both Execution |
here is the sample test code.
No comments:
Post a Comment