|
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!   
|