Beispiel #1
0
        private async Task <WebSiteGetPublishProfileResponse> GetPublishProfile(WebSiteManagementClient client, string SiteName)
        {
            string Location = "SouthCentralUSwebspace";
            WebSiteGetPublishProfileResponse res = await client.WebSites.GetPublishProfileAsync(Location, SiteName);

            return(res);
        }
Beispiel #2
0
        private async Task <string> CreatePubXML(Application app, string PublicId)
        {
            if (app == null)
            {
                return("App is Null");
            }
            //Create Azure Website
            Websites website = new Websites();
            WebSiteGetPublishProfileResponse pubProfile = await website.CreateWebsite(app.url);

            if (pubProfile == null)
            {
                return("pubProfile is Null");
            }

            var profile = pubProfile.PublishProfiles[0];
            //Create Publish XML File
            string pubPath    = Server.MapPath("~/App_Data/" + PublicId + "/");
            string pubXmlFile = app.Name + "#" + app.url + ".pubxml";

            PubXML pubXml = new PubXML();

            pubXml.UserName                    = profile.UserName;
            pubXml.Password                    = profile.UserPassword;
            pubXml.MSDeployServiceURL          = profile.PublishUrl;
            pubXml.DeployIisAppPath            = profile.MSDeploySite;
            pubXml.SiteUrlToLaunchAfterPublish = profile.DestinationAppUri.AbsoluteUri;

            System.IO.File.AppendAllText(pubPath + pubXmlFile, pubXml.TransformText());
            return(profile.DestinationAppUri.AbsoluteUri);
        }
        private static DeploymentBaseOptions DeploymentOptions(
            WebSiteGetPublishProfileResponse.PublishProfile publishProfile)
        {
            var options = new DeploymentBaseOptions
            {
                AuthenticationType = "Basic",
                RetryAttempts = 3,
                RetryInterval = 1000,
                TraceLevel = TraceLevel.Verbose,
                UserName = publishProfile.UserName,
                Password = publishProfile.UserPassword,
                UserAgent = "OctopusDeploy/1.0",
                ComputerName = string.Format("https://{0}/msdeploy.axd?site={1}", publishProfile.PublishUrl, publishProfile.MSDeploySite),
            };
            options.Trace += (sender, eventArgs) => LogDeploymentEvent(eventArgs);

            return options;
        }