public override void Run() { Trace.TraceInformation("WorkerRole1 is running"); while (true) { CloudQueueMessage smessage = DBConnect.GetStopStartQueue().GetMessage(TimeSpan.FromMinutes(5)); if (smessage != null) { if (smessage.AsString == "start" || Crawler.crawling) { Crawler.crawling = true; DBConnect.GetStopStartQueue().DeleteMessage(smessage); Crawler.StartCrawl(); } else { DBConnect.GetStopStartQueue().DeleteMessage(smessage); } } if (Crawler.crawling) { Crawler.StartCrawl(); } Thread.Sleep(3000); } }