Steven Wood's Weblog
home bio email
vox lite infinity games
09 September 2003

It looks like the implementation of the SingleInstanceApplication does not renew the lease on the remote service, resulting in the single instance functionality been lost after a few minutes. This could be a .NET framework 1.0/1.1 issue as I'm sure this must have worked when the article was originally written. Anyhow's after a little digging I found the following article on .NET Remoting covering leases and using sponsors to renew remote services. Here’s the code I added to UserApplicationContext.cs to resolve the issue...

      public class MySponsor: ClientSponsor, ISponsor

      {

            TimeSpan ISponsor.Renewal(ILease lease)

            {

                  Debug.WriteLine("Renewal called" + lease.CurrentLeaseTime);

                  return this.RenewalTime;

            }

      }    

 

Added in Class: UserApplicationContext

static MySponsor sponsor;

Added to Method: public static int Run(string[] args, Type userApplicationType)

 

using (RegistryKey key = Application.UserAppDataRegistry)

      {

            key.SetValue(SingletonCommunicatorName, SingletonCommunicatorUrl);

      }

 

      sponsor = new MySponsor();

      sponsor.RenewalTime = TimeSpan.FromMinutes(1);

      sponsor.Register(comm);

                       

return ProcessRun(args, userApplicationType);

P.S. this fix will be making it into the next version of Vox Lite, which will arriving sometime in the next 2 weeks.

5:48:20 AM  Google It!  comment []  trackback []


September 2003
Sun Mon Tue Wed Thu Fri Sat
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30        
Aug   Oct

A picture named feedster.gif

Contact

email
AIM : swoodvox

projects

vox lite
infinity games

syndication

Click to see the XML version of this web page.

A picture named btn_vox.gif

Subscribe to "Steven Wood" in Radio UserLand.


© Copyright 2003 Steven Wood.
Last update: 03/10/2003; 10:46:14.