示例#1
0
        private async Task InitializeSite()
        {
            Telemetry.TrackEvent(new EventTelemetry("EnvironmentInitialization"));

            Trace.WriteLine("Initializing environment...");

            await StopSite();

            await AddSettings();

            _kuduClient = new KuduClient($"https://{Settings.SiteName}.scm.azurewebsites.net", Settings.SitePublishingUser, Settings.SitePublishingPassword);

            await UpdateRuntime();

            await UpdateSiteContents();

            await StartSite();

            await InitializeFunctionKeys();

            Trace.WriteLine("Restarting site...");
            await RestartSite();

            Trace.WriteLine("Environment initialized.");
            Telemetry.TrackEvent(new EventTelemetry("EnvironmentInitialized"));
        }
        private async Task Initialize()
        {
            Telemetry.TrackEvent(new EventTelemetry("EnvironmentInitialization"));
            Trace.WriteLine("Initializing environment...");

            _kuduClient = new KuduClient($"https://{Settings.SiteName}.scm.azurewebsites.net", Settings.SitePublishingUser, Settings.SitePublishingPassword);
            FunctionAppMasterKey = await _kuduClient.GetFunctionsMasterKey();

            // to run tests against currently deployed site, skip
            // this step (can take over 2 minutes)
            await RedeployTestSite();

            // ensure that our current client key is set as
            // the default key for all http functions
            await InitializeFunctionKeys();

            // after all initialization is done, do a final restart for good measure
            await RestartSite();

            Trace.WriteLine("Environment initialized");
            Telemetry.TrackEvent(new EventTelemetry("EnvironmentInitialized"));

            Trace.WriteLine("Test run starting...");
        }