static HomeController()
 {
     var cloudStorageConfigSetting = CloudConfigurationManager.GetSetting(CLOUD_STORAGE_ACCOUNT_CONFIG_SETTING);
     var cloudStorageAccount = CloudStorageAccount.Parse(cloudStorageConfigSetting);
     _blobStorage = BlobStorage.Create(cloudStorageAccount, CLOUD_BLOB_REFERENCE);
     _queueStorage = QueueStorage.Create(cloudStorageAccount, CLOUD_QUEUE_REFERENCE);
 }
        public override bool OnStart()
        {
            // Set the maximum number of concurrent connections 
            ServicePointManager.DefaultConnectionLimit = 12;

            bool storageInitialised = false;
            while (!storageInitialised)
            {
                try
                {
                    // Initialise Cloud Blob & Queue clients
                    string cloudStorageConfigSetting = CloudConfigurationManager.GetSetting(CLOUD_STORAGE_ACCOUNT_CONFIG_SETTING);
                    CloudStorageAccount cloudStorageAccount = CloudStorageAccount.Parse(cloudStorageConfigSetting);
                    _blobStorage = BlobStorage.Create(cloudStorageAccount, CLOUD_BLOB_REFERENCE);
                    _queueStorage = QueueStorage.Create(cloudStorageAccount, CLOUD_QUEUE_REFERENCE);
                    storageInitialised = true;
                }
                catch (Exception exception)
                {
                    Trace.TraceError(exception.Message);
                    Thread.Sleep(5000);
                }
            }

            // For information on handling configuration changes
            // see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.

            return base.OnStart();
        }