void Application_Start(object sender, EventArgs e)
        {
            // Code that runs on application startup
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            AuthConfig.RegisterOpenAuth();

            CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) =>
            {
                configSetter(RoleEnvironment.GetConfigurationSettingValue(configName));
            });
        }
Exemple #2
0
        public override void Run()
        {
            CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) =>
            {
                configSetter(RoleEnvironment.GetConfigurationSettingValue(configName));
            });

            //Initialize
            var storageAccount = CloudStorageAccount.FromConfigurationSetting("ConnectionString");
            var queueClient    = storageAccount.CreateCloudQueueClient();
            var EventsQueue    = queueClient.GetQueueReference("earthquakes");
            var StationsQueue  = queueClient.GetQueueReference("stations");
            var ReducerQueue   = queueClient.GetQueueReference("reducer");

            while (true)
            {
                Thread.Sleep(10000);
                CloudQueueMessage EventMessage = EventsQueue.GetMessage(TimeSpan.FromMinutes(2));
                if (EventMessage != null)
                {
                    QuakeMessage quake = DeserialeMessage(EventMessage);
                    quake.CalculateGeometry();

                    quake.CalculateCenter();
                    var service = storageAccount.CreateCloudTableClient().GetDataServiceContext();
                    service.IgnoreResourceNotFoundException = true;
                    service.IgnoreMissingProperties         = true;
                    IQueryable <StationsInfo> StationsList;
                    if (!String.IsNullOrEmpty(quake.StationsGroup))
                    {
                        StationsList = (from c in service.CreateQuery <StationsInfo>("Stations").AsTableServiceQuery()
                                        where c.PartitionKey == quake.StationsGroup
                                        select c);
                    }
                    else
                    {
                        StationsList = CalculateGrid(quake);
                    }
                    int Counter = 0;
                    foreach (var item in StationsList)
                    {
                        quake.StationCode = item.Code;
                        quake.Station     = item;
                        CloudQueueMessage StationMessage = new CloudQueueMessage(quake.ToXml());
                        StationsQueue.AddMessage(StationMessage);
                        Counter++;
                    }
                    CloudQueueMessage ReducerMessage = new CloudQueueMessage(String.Format("{0};{1};{2}", quake.EventID.ToLower(), Counter, quake.DeleteMe.ToString()));
                    ReducerQueue.AddMessage(ReducerMessage);

                    EventsQueue.DeleteMessage(EventMessage);
                }
            }
        }
Exemple #3
0
        protected void Application_Start()
        {
            CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) =>
            {
                configSetter(RoleEnvironment.GetConfigurationSettingValue(configName));
            });

            AreaRegistration.RegisterAllAreas();

            RegisterRoutes(RouteTable.Routes);
        }
Exemple #4
0
        // Credit: Jonathon Wiggs MSDN Article http://msdn.microsoft.com/en-us/magazine/ee291586.aspx

        public Security()
        {
            CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) =>
            {
                configSetter(Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.GetConfigurationSettingValue(configName));
            });

            CloudStorageAccount = CloudStorageAccount.FromConfigurationSetting("SaaS");

            CreateRSAProvider();
        }
Exemple #5
0
        void Application_Start(object sender, EventArgs e)
        {
            CloudStorageAccount.SetConfigurationSettingPublisher
            (
                (configName, configSetter) =>
                configSetter(RoleEnvironment.GetConfigurationSettingValue(configName))
            );

            BundleConfig.RegisterBundles(BundleTable.Bundles);
            AuthConfig.RegisterOpenAuth();
            RouteConfig.RegisterRoutes(RouteTable.Routes);
        }
        StashConfiguration()
        {
            // *** Change type here switch between storage emulator and the cloud storage ***
            ConfigType = ConfigurationType.StashEmulator;

#if USE_STORAGE_CLIENT
            CloudStorageAccount.SetConfigurationSettingPublisher(
                (configName, configSetter) =>
                configSetter(
                    ConfigurationManager.AppSettings[configName]));
#endif
        }
        public override bool OnStart()
        {
            DiagnosticsHelper.TraceInformation("MongoWorkerRole onstart called");

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

            // Set the maximum number of concurrent connections
            ServicePointManager.DefaultConnectionLimit = 12;

            CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) =>
            {
                configSetter(RoleEnvironment.GetConfigurationSettingValue(configName));
            });

            RoleEnvironment.Changing += RoleEnvironmentChanging;
            RoleEnvironment.Changed  += RoleEnvironmentChanged;

            replicaSetName = RoleEnvironment.GetConfigurationSettingValue(Constants.ReplicaSetNameSetting);
            instanceId     = ConnectionUtilities.ParseNodeInstanceId(RoleEnvironment.CurrentRoleInstance.Id);

            DiagnosticsHelper.TraceInformation("ReplicaSetName={0}, InstanceId={1}",
                                               replicaSetName, instanceId);

            SetHostAndPort();
            DiagnosticsHelper.TraceInformation("Obtained host={0}, port={1}", mongodHost, mongodPort);

            StartMongoD();
            DiagnosticsHelper.TraceInformation("Mongod process started");

            // Need to ensure MongoD is up here
            DatabaseHelper.EnsureMongodIsListening(replicaSetName, instanceId, mongodPort);

            if ((instanceId == 0) && !DatabaseHelper.IsReplicaSetInitialized(mongodPort))
            {
                try
                {
                    DatabaseHelper.RunInitializeCommandLocally(replicaSetName, mongodPort);
                    DiagnosticsHelper.TraceInformation("RSInit issued successfully");
                }
                catch (MongoCommandException e)
                {
                    //Ignore exceptions caught on rs init for now
                    DiagnosticsHelper.TraceWarning(
                        "Exception {0} on RSInit with {1}",
                        e.Message, e.StackTrace);
                }
            }

            DiagnosticsHelper.TraceInformation("Done with OnStart");
            return(true);
        }
Exemple #8
0
        public override bool OnStart()
        {
            try
            {
                DiagnosticMonitorConfiguration diagConfig = DiagnosticMonitor.GetDefaultInitialConfiguration();
                //diagConfig.Directories.ScheduledTransferPeriod = TimeSpan.FromMinutes(5);
                diagConfig.Logs.ScheduledTransferPeriod         = TimeSpan.FromMinutes(1);
                diagConfig.Logs.ScheduledTransferLogLevelFilter = LogLevel.Verbose;

                DiagnosticMonitor.Start("DataConnectionString", diagConfig);

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

                // This code sets up a handler to update CloudStorageAccount instances when their corresponding
                // configuration settings change in the service configuration file.

                // This code sets up a handler to update CloudStorageAccount instances when their corresponding
                // configuration settings change in the service configuration file.
                CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) =>
                {
                    // Provide the configSetter with the initial value
                    configSetter(RoleEnvironment.GetConfigurationSettingValue(configName));

                    RoleEnvironment.Changed += (s, arg) =>
                    {
                        if (arg.Changes.OfType <RoleEnvironmentConfigurationSettingChange>()
                            .Any((change) => (change.ConfigurationSettingName == configName)))
                        {
                            // The corresponding configuration setting has changed, propagate the value
                            if (!configSetter(RoleEnvironment.GetConfigurationSettingValue(configName)))
                            {
                                // In this case, the change to the storage account credentials in the
                                // service configuration is significant enough that the role needs to be
                                // recycled in order to use the latest settings. (for example, the
                                // endpoint has changed)
                                RoleEnvironment.RequestRecycle();
                            }
                        }
                    };
                });

                var azureTraceListener = new Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener();

                Trace.Listeners.Add(azureTraceListener);
            }
            catch (Exception)
            {
            }
            return(base.OnStart());
        }
Exemple #9
0
 public static void InitCloud()
 {
     if (RoleEnvironment.IsAvailable)
     {
         //FromConfigurationSetting method executes the delegate passed to SetConfigurationSettingPublisher
         //call SetConfigurationSettingPublisher, passing in the logic to get connection string data from your custom source.
         CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) =>
         {
             var connectionString = RoleEnvironment.GetConfigurationSettingValue(configName);
             configSetter(connectionString); //configSetter is the delegate
         });
     }
 }
        public void Setup()
        {
            CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) =>
            {
                string configuration = RoleEnvironment.IsAvailable ?
                                       RoleEnvironment.GetConfigurationSettingValue(configName) :
                                       ConfigurationManager.AppSettings[configName];

                configSetter(configuration);
            });

            this.suffix = (new Random()).Next(10000);
        }
Exemple #11
0
        protected void Application_Start(object sender, EventArgs e)
        {
            CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) =>
            {
                string connectionString;
                connectionString = ConfigurationManager.AppSettings[configName];
                configSetter(connectionString);
            });
            CloudTraceListener.StorageTraceListener.Instance.Write("Initialised");
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            RegisterRoutes(RouteTable.Routes);
        }
        private static void SetConfigurationSettingPublisher()
        {
            CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) =>
            {
                string value = ConfigurationManager.AppSettings[configName];
                if (RoleEnvironment.IsAvailable)
                {
                    value = RoleEnvironment.GetConfigurationSettingValue(configName);
                }

                configSetter(value);
            });
        }
        void Application_Start(object sender, EventArgs e)
        {
            // Code that runs on application startup
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            // This code sets up a handler to update CloudStorageAccount instances when their corresponding
            // configuration settings change in the service configuration file.
            CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) =>
            {
                // Provide the configSetter with the initial value
                configSetter(RoleEnvironment.GetConfigurationSettingValue(configName));
            });
        }
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            AuthConfig.RegisterAuth();

            CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) => configSetter(ConfigSettingPublisher.GetSettingValue(configName)));
            Database.SetInitializer <TeamPortalWebContext>(new TeamPortalDbInitializer());
        }
Exemple #15
0
        protected void Application_Start(object sender, EventArgs e)
        {
            // This code sets up a handler to update CloudStorageAccount instances when their corresponding
            // configuration settings change in the service configuration file.
            CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) =>
            {
                // Provide the configSetter with the initial value
                configSetter(RoleEnvironment.GetConfigurationSettingValue(configName));

                RoleEnvironment.Changed += (anotherSender, arg) =>
                {
                    if (arg.Changes.OfType <RoleEnvironmentConfigurationSettingChange>()
                        .Any((change) => (change.ConfigurationSettingName == configName)))
                    {
                        // The corresponding configuration setting has changed, propagate the value
                        if (!configSetter(RoleEnvironment.GetConfigurationSettingValue(configName)))
                        {
                            // In this case, the change to the storage account credentials in the
                            // service configuration is significant enough that the role needs to be
                            // recycled in order to use the latest settings. (for example, the
                            // endpoint has changed)
                            RoleEnvironment.RequestRecycle();
                        }
                    }
                };
            });

            var account = CloudStorageAccount.FromConfigurationSetting("DataConnectionString");

            // Create the table and add some dummy data.
            CloudTableClient tableClient = new CloudTableClient(account.TableEndpoint.AbsoluteUri, account.Credentials);

            tableClient.CreateTableIfNotExist("Person");
            PersonTableStorageContext ctx = new PersonTableStorageContext();
            Person person1 = new Person("DefaultPartition", "Row1")
            {
                Name = "Ared", Age = 24
            };
            Person person2 = new Person("DefaultPartition", "Row2")
            {
                Name = "Lante", Age = 24
            };
            Person person3 = new Person("DefaultPartition", "Row3")
            {
                Name = "Bright", Age = 24
            };

            this.InsertEntityIfNotExist(ctx, person1);
            this.InsertEntityIfNotExist(ctx, person2);
            this.InsertEntityIfNotExist(ctx, person3);
        }
        public override bool OnStart()
        {
            // Set the maximum number of concurrent connections
            ServicePointManager.DefaultConnectionLimit = 12;

            // For information on handling configuration changes
            // see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.
            CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) =>
            {
                configSetter(RoleEnvironment.GetConfigurationSettingValue(configName));
            });

            return(base.OnStart());
        }
Exemple #17
0
        public override bool OnStart()
        {
            // Set the maximum number of concurrent connections
            ServicePointManager.DefaultConnectionLimit = 12;

            CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) => configSetter(RoleEnvironment.GetConfigurationSettingValue(configName)));
            CloudStorageAccount storageAccount = CloudStorageAccount.FromConfigurationSetting("DataConnectionString");

            InitializeStorageResources(storageAccount);

            _service = new CommandHandler();

            return(base.OnStart());
        }
        static EventMessageDataSource()
        {
            CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) =>
            {
                configSetter(RoleEnvironment.GetConfigurationSettingValue(configName));
            });

            storageAccount = CloudStorageAccount.FromConfigurationSetting("DataConnectionString");

            CloudTableClient.CreateTablesFromModel(
                typeof(EventMessageDataContext),
                storageAccount.TableEndpoint.AbsoluteUri,
                storageAccount.Credentials);
        }
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);

            BundleTable.Bundles.EnableDefaultBundles();

            CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) =>
            {
                configSetter(ConfigurationManager.ConnectionStrings[configName].ConnectionString);
            });
        }
Exemple #20
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) =>
            {
                configSetter(RoleEnvironment.GetConfigurationSettingValue(configName));
            });

            BundleConfig.RegisterBundles(BundleTable.Bundles);
        }
Exemple #21
0
        public override bool OnStart()
        {
            // 设置的最大并发连接数
            ServicePointManager.DefaultConnectionLimit = 12;

            // 有关处理配置更改信息
            // 请参阅 MSDN 主题在  http://go.microsoft.com/fwlink/?LinkId=166357.

            // 如果没有被初始化,初始化存储.
            CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) =>
            {
                configSetter(RoleEnvironment.GetConfigurationSettingValue(configName));
            });
            this._storageAccount = CloudStorageAccount.FromConfigurationSetting("DataConnectionString");
            CloudBlobClient blobClient = new CloudBlobClient(this._storageAccount.BlobEndpoint, this._storageAccount.Credentials);

            this._container = blobClient.GetContainerReference("videostories");
            this._container.CreateIfNotExist();
            this._container.SetPermissions(new BlobContainerPermissions()
            {
                PublicAccess = BlobContainerPublicAccessType.Blob
            });
            CloudQueueClient queueClient = new CloudQueueClient(this._storageAccount.QueueEndpoint, this._storageAccount.Credentials);

            this._queue = queueClient.GetQueueReference("videostories");
            this._queue.CreateIfNotExist();
            CloudTableClient tableClient = new CloudTableClient(this._storageAccount.TableEndpoint.AbsoluteUri, this._storageAccount.Credentials);

            tableClient.CreateTableIfNotExist("Stories");

            // 配置诊断程序.
            var config = DiagnosticMonitor.GetDefaultInitialConfiguration();

            config.Logs.ScheduledTransferPeriod            = TimeSpan.FromMinutes(10d);
            config.WindowsEventLog.ScheduledTransferPeriod = TimeSpan.FromMinutes(10d);
            config.Directories.ScheduledTransferPeriod     = TimeSpan.FromMinutes(10d);
            config.Directories.DataSources.Add(new DirectoryConfiguration()
            {
                Path               = RoleEnvironment.GetLocalResource("DiagnosticStore").RootPath,
                Container          = "videostorydiagnosticstore",
                DirectoryQuotaInMB = 200
            });
            config.PerformanceCounters.ScheduledTransferPeriod = TimeSpan.FromMinutes(10d);
            Microsoft.WindowsAzure.Diagnostics.CrashDumps.EnableCollection(true);
            DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString", config);
            RoleEnvironment.Changing += new EventHandler <RoleEnvironmentChangingEventArgs>(RoleEnvironment_Changing);

            return(base.OnStart());
        }
Exemple #22
0
        public override bool OnStart()
        {
            /*
             * var config = DiagnosticMonitor.GetDefaultInitialConfiguration();
             *
             * config.DiagnosticInfrastructureLogs.ScheduledTransferLogLevelFilter = LogLevel.Error;
             * config.DiagnosticInfrastructureLogs.ScheduledTransferPeriod = TimeSpan.FromMinutes(5);
             * // Start the diagnostic monitor with the modified configuration.
             * DiagnosticMonitor.Start("DiagnosticsConnectionString", config);
             *
             * DiagnosticMonitor.AllowInsecureRemoteConnections = true;
             *
             * // enable collection of crashdumps
             * CrashDumps.EnableCollection(true);
             */
            #region Setup CloudStorageAccount Configuration Setting Publisher

            // This code sets up a handler to update CloudStorageAccount instances when their corresponding
            // configuration settings change in the service configuration file.
            CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) =>
            {
                // Provide the configSetter with the initial value
                configSetter(RoleEnvironment.GetConfigurationSettingValue(configName));

                RoleEnvironment.Changed += (sender, arg) =>
                {
                    if (arg.Changes.OfType <RoleEnvironmentConfigurationSettingChange>()
                        .Any((change) => (change.ConfigurationSettingName == configName)))
                    {
                        // The corresponding configuration setting has changed, propagate the value
                        if (!configSetter(RoleEnvironment.GetConfigurationSettingValue(configName)))
                        {
                            // In this case, the change to the storage account credentials in the
                            // service configuration is significant enough that the role needs to be
                            // recycled in order to use the latest settings. (for example, the
                            // endpoint has changed)
                            RoleEnvironment.RequestRecycle();
                        }
                    }
                };
            });
            #endregion

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

            return(base.OnStart());
        }
Exemple #23
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);

            CloudStorageAccount.SetConfigurationSettingPublisher(
                (configName, configSettingPublisher) =>
            {
                var connectionString = RoleEnvironment.IsAvailable ? RoleEnvironment.GetConfigurationSettingValue(configName) :
                                       ConfigurationManager.AppSettings[configName];
                configSettingPublisher(connectionString);
            });
        }
Exemple #24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) =>
                {
                    configSetter(RoleEnvironment.GetConfigurationSettingValue(configName));
                });
            }

            var storageAccount           = CloudStorageAccount.FromConfigurationSetting("DataConnectionString");
            CloudTableClient tableClient = storageAccount.CreateCloudTableClient();

            tableClient.CreateTableIfNotExist("Products");
        }
Exemple #25
0
        static Context()
        {
            CloudStorageAccount.SetConfigurationSettingPublisher((configname, configsettingsPublisher) =>
            {
                var connectionString = RoleEnvironment.GetConfigurationSettingValue(configname);
                configsettingsPublisher(connectionString);
            });
            account = CloudStorageAccount.FromConfigurationSetting("DataConnectionString");
            CloudTableClient tableClient = new CloudTableClient(account.TableEndpoint.AbsoluteUri, account.Credentials);

            tableClient.CreateTableIfNotExist(PLAYER);
            tableClient.CreateTableIfNotExist(GAME);
            //tableClient.DeleteTableIfExist(PLAYER);
            //tableClient.DeleteTableIfExist(GAME);
        }
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);

            CloudStorageAccount.SetConfigurationSettingPublisher(
                (name, publisher) =>
            {
                var connectionString = RoleEnvironment.GetConfigurationSettingValue(name);
                publisher(connectionString);
            }
                );
        }
Exemple #27
0
        public override bool OnStart()
        {
            DiagnosticMonitor.Start("DiagnosticsConnectionString");

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


            CloudStorageAccount.SetConfigurationSettingPublisher(
                (configName, configSetter) => configSetter(RoleEnvironment.GetConfigurationSettingValue(configName))
                );

            return(base.OnStart());
        }
Exemple #28
0
 public static void EnsureAzureConfig()
 {
     // get settings from azure settings or app.config
     CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) =>
     {
         try
         {
             configSetter(RoleEnvironment.GetConfigurationSettingValue(configName));
         }
         catch (Exception)
         {
             // for a console app, reading from App.config
             configSetter(System.Configuration.ConfigurationManager.AppSettings[configName]);
         }
     });
 }
        public void UserRepositoryDefaultConstructor()
        {
            bool wasSetterCalled = false;

            CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) =>
            {
                if (configName == "DataConnectionString")
                {
                    wasSetterCalled = true;
                    configSetter("UseDevelopmentStorage=true");
                }
            });

            new UserRepository(null, null, null);
            Assert.IsTrue(wasSetterCalled);
        }
Exemple #30
0
        public override bool OnStart()
        {
            // Set the maximum number of concurrent connections
            ServicePointManager.DefaultConnectionLimit = 12;

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

            #region Setup CloudStorageAccount Configuration Setting Publisher

            // This code sets up a handler to update CloudStorageAccount instances when their corresponding
            // configuration settings change in the service configuration file.
            CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) =>
            {
                // Provide the configSetter with the initial value
                configSetter(RoleEnvironment.GetConfigurationSettingValue(configName));

                RoleEnvironment.Changed += (sender, arg) =>
                {
                    if (arg.Changes.OfType <RoleEnvironmentConfigurationSettingChange>()
                        .Any((change) => (change.ConfigurationSettingName == configName)))
                    {
                        // The corresponding configuration setting has changed, propagate the value
                        if (!configSetter(RoleEnvironment.GetConfigurationSettingValue(configName)))
                        {
                            // In this case, the change to the storage account credentials in the
                            // service configuration is significant enough that the role needs to be
                            // recycled in order to use the latest settings. (for example, the
                            // endpoint has changed)
                            RoleEnvironment.RequestRecycle();
                        }
                    }
                };
            });

            #endregion

            // load up the desired image sizes
            var imageSizes = RoleEnvironment.GetConfigurationSettingValue("ImageSizes");
            foreach (var size in imageSizes.Split(','))
            {
                var dims = size.Split('x');
                _imageSizes.Add(new Size(Int32.Parse(dims[0]), Int32.Parse(dims[1])));
            }

            return(base.OnStart());
        }