/// <summary> /// Stop service /// </summary> public static void Stop() { lock (sync) { HttpRuntime.Cache.Remove(instance.cacheKey); instance = null; } }
/// <summary> /// Start service /// </summary> /// <param name="applicationUrl">Url to ping</param> public static void Start(string applicationUrl) { if (IsKeepingAlive) { return; } lock (sync) { instance = new KeepAlive(applicationUrl); instance.Insert(); } }
private KeepAlive(string applicationUrl) { this.applicationUrl = applicationUrl; this.cacheKey = Guid.NewGuid().ToString(); instance = this; }