public override bool OnStart() { // Set the maximum number of concurrent connections ServicePointManager.DefaultConnectionLimit = 12; // read storage account configuration settings CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) => { configSetter(RoleEnvironment.GetConfigurationSettingValue(configName)); }); var _azure = new AzureRealm(); // initialize blob storage _storage = _azure.StorageProvider; _storage.CreateBucket("guestbookpics1"); // initialize queue storage _queueProvider = _azure.QueueProvider; _queueProvider.CreateQueue("guestthumbs"); _queue = _queueProvider.GetQueueById("guestthumbs"); Trace.TraceInformation("Creating container and queue..."); return base.OnStart(); }
/* private GuestBookDataContext context; */ static GuestBookDataSource() { // TODO: storageAccount = CloudStorageAccount.FromConfigurationSetting("DataConnectionString"); ICredentials credentials = null; _azure = new AzureRealm(); _storage = _azure.KvStorageProvider; _storage.CreateTable("GuestBookEntry1"); // TODO: //_storage.CreateTablesFromModel( // typeof(GuestBookDataContext), // "", // credentials); }
public void UploadPackage() { IRealm realm = new AzureRealm(); var storage = realm.StorageProvider; /* var buckets = storage.Buckets; foreach (var bucket in buckets) { Console.WriteLine(bucket.Name); } */ string bucketName = "igor_another_test"; //var bucket1 = storage.CreateBucket(bucketName); string filePath = @"C:\Temp\kinect.jpg"; storage.AddToBucket(bucketName, filePath); //storage.DeleteFromBucket(bucketName, Path.GetFileName(filePath)); }
private void InitializeStorage() { if (storageInitialized) { return; } lock (gate) { if (storageInitialized) { return; } try { // create blob container for images var _azure = new AzureRealm(); _storage = _azure.StorageProvider; _storage.CreateBucket("guestbookpics1"); //_storage.CreateIfNotExist(); // configure container for public access //var permissions = container.GetPermissions(); //permissions.PublicAccess = BlobContainerPublicAccessType.Container; //container.SetPermissions(permissions); // create queue to communicate with worker role _queue = _azure.QueueProvider; _queue.CreateQueue("guestthumbs"); //queue.CreateIfNotExist(); } catch (WebException) { throw new WebException("Storage services initialization failure. " + "Check your storage account configuration settings. If running locally, " + "ensure that the Development Storage service is running."); } storageInitialized = true; } }