コード例 #1
0
 public void Setup()
 {
     this.webSiteTable = new AzureTable<WebSiteRow>(CloudStorageAccount.DevelopmentStorageAccount, "WebSitesTest");
     this.bindingTable = new AzureTable<BindingRow>(CloudStorageAccount.DevelopmentStorageAccount, "BindingsTest");
     this.certificateRepository = new CertificateRepository();
     this.webSiteTable.CreateIfNotExist();
     this.bindingTable.CreateIfNotExist();
     this.webSiteRepository = new WebSiteRepository(this.webSiteTable, this.bindingTable);
     this.controller = new WebSiteController(this.webSiteRepository, this.certificateRepository);
 }
コード例 #2
0
        public SyncService(WebSiteRepository sitesRepository, CertificateRepository certificateRepository, SyncStatusRepository syncStatusRepository, CloudStorageAccount storageAccount, string localSitesPath, string localTempPath, IEnumerable<string> directoriesToExclude)
        {
            this.sitesRepository = sitesRepository;
            this.certificateRepository = certificateRepository;
            this.syncStatusRepository = syncStatusRepository;

            this.localSitesPath = localSitesPath;
            this.localTempPath = localTempPath;
            this.directoriesToExclude = directoriesToExclude;
            this.entries = new Dictionary<string, FileEntry>();
            this.siteDeployTimes = new Dictionary<string, DateTime>();

            var sitesContainerName = RoleEnvironment.GetConfigurationSettingValue("SitesContainerName").ToLowerInvariant();
            this.container = storageAccount.CreateCloudBlobClient().GetContainerReference(sitesContainerName);
            this.container.CreateIfNotExist();
        }
コード例 #3
0
        public override bool OnStart()
        {
            ServicePointManager.DefaultConnectionLimit = 12;
            CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) =>
            {
                string configuration = RoleEnvironment.IsAvailable ?
                    RoleEnvironment.GetConfigurationSettingValue(configName) :
                    ConfigurationManager.AppSettings[configName];

                configSetter(configuration);
            });

            ConfigureDiagnosticMonitor();

            Trace.TraceInformation("WebRole.OnStart");

            // Initialize local resources
            var localSitesPath = GetLocalResourcePathAndSetAccess("Sites");
            var localTempPath = GetLocalResourcePathAndSetAccess("TempSites");

            // Get settings
            var directoriesToExclude = RoleEnvironment.GetConfigurationSettingValue("DirectoriesToExclude").Split(';');

            // WebDeploy creates temporary files during package creation. The default TEMP location allows for a 100MB
            // quota (see http://msdn.microsoft.com/en-us/library/gg465400.aspx#Y976).
            // For large web deploy packages, the synchronization process will raise an IO exception because the "disk is full"
            // unless you ensure that the TEMP/TMP target directory has sufficient space
            Environment.SetEnvironmentVariable("TMP", localTempPath);
            Environment.SetEnvironmentVariable("TEMP", localTempPath);

            // Populate the certificate repository.
            var certRepo = new CertificateRepository();
            certRepo.PopulateRepository();

            // Create the sync service and update the sites status
            this.syncService = new SyncService(localSitesPath, localTempPath, directoriesToExclude, "DataConnectionstring");
            this.syncService.Start();

            return base.OnStart();
        }
コード例 #4
0
        public void Setup()
        {
            this.webSiteTable = new AzureTable<WebSiteRow>(CloudStorageAccount.DevelopmentStorageAccount, "WebSitesTest");
            this.bindingTable = new AzureTable<BindingRow>(CloudStorageAccount.DevelopmentStorageAccount, "BindingsTest");
            this.webSiteTable.CreateIfNotExist();
            this.bindingTable.CreateIfNotExist();
            this.webSiteRepository = new WebSiteRepository(this.webSiteTable, this.bindingTable);

            this.certificateTable = new AzureTable<CertificateRow>(CloudStorageAccount.DevelopmentStorageAccount, "CertificatesTest");
            this.certificateTable.CreateIfNotExist();
            this.certificateBlobContainer = new AzureBlobContainer<byte[]>(CloudStorageAccount.DevelopmentStorageAccount, "CertificatesTest");
            this.certificateBlobContainer.EnsureExist();
            this.certificateRepository = new CertificateRepository(this.certificateTable, this.certificateBlobContainer, this.webSiteRepository);
        }