private void SetWebsiteToStandard(string websiteName)
        {
            WebSiteUpdateParameters updateParameters = new WebSiteUpdateParameters();

            updateParameters.ServerFarm = WebsiteServerFarmName;
            updateParameters.HostNames  = this.GetWebsiteHostNames(websiteName);
            WebsiteManagementClient.WebSites.Update(WebSpaceName, websiteName, updateParameters);
        }
Exemple #2
0
 public async Task <string> ChangeAppState(string websiteName, string state)
 {
     using (var client = GetWebSiteManagementClient())
     {
         WebSiteUpdateParameters _params = new WebSiteUpdateParameters();
         //_params.State = "";
         //WebSiteUpdateResponse resp = await client.WebSites.UpdateAsync("SouthCentralUSwebspace", websiteName, _params);
         return("");
     }
 }
Exemple #3
0
        /// <summary>
        /// Update the set of host names for a website.
        /// </summary>
        /// <param name="site">The site name.</param>
        /// <param name="hostNames">The new host names.</param>
        public void UpdateWebsiteHostNames(Site site, IEnumerable <string> hostNames)
        {
            var update = new WebSiteUpdateParameters();

            foreach (var name in hostNames)
            {
                update.HostNames.Add(name);
            }

            WebsiteManagementClient.WebSites.Update(site.WebSpace, site.Name, update);
        }
Exemple #4
0
        public async Task <string> RestartWebSite(string websiteName)
        {
            using (var client = GetWebSiteManagementClient())
            {
                WebSiteUpdateParameters _params = new WebSiteUpdateParameters();
                //_params.State = "";
                OperationResponse resp = await client.WebSites.RestartAsync("SouthCentralUSwebspace", websiteName);

                //WebSiteUpdateResponse resp = await client.WebSites.UpdateAsync("SouthCentralUSwebspace", websiteName, _params);
                return(resp.RequestId);
            }
        }
Exemple #5
0
        internal async Task UpgradeWebSite()
        {
            if (_parameters.UpgradePlan == WebSitePlans.Standard)
            {
                // Standard mode requires a ServerFarm update
                await UpdateWebHostingPlan();
            }
            var resp = await _webSiteManagementClient.WebSites.GetAsync(_webSpaceDetails.Name, _parameters.WebSiteName, new WebSiteGetParameters { });

            WebSiteUpdateParameters updateParameters = new WebSiteUpdateParameters
            {
                HostNames  = resp.WebSite.HostNames,
                ServerFarm = _parameters.UpgradePlan == WebSitePlans.Standard ? WebHostingPlanName : resp.WebSite.ServerFarm
            };

            await _webSiteManagementClient.WebSites.UpdateAsync(_webSpaceDetails.Name, _parameters.WebSiteName, updateParameters);
        }
        static void Main(string[] args)
        {
            var credential = new CertificateCloudCredentials(SubscriptionId, cert);

            _WebSiteClient = new WebSiteManagementClient(credential);
            var web = _WebSiteClient.WebSites.Get(webspace, websitename, null).WebSite;

            web.HostNames.Add("www.example.com");
            var updates = new WebSiteUpdateParameters {
                HostNames  = web.HostNames,
                ServerFarm = web.ServerFarm,
                State      = web.State
            };

            _WebSiteClient.WebSites.Update(webspaces, websitename, updates);
            System.Console.WriteLine("Press ENTER to continue");
            System.Console.ReadLine();
        }
 /// <summary>
 ///     Update website
 /// </summary>
 /// <param name="webSpaceName"></param>
 /// <param name="siteName"></param>
 /// <param name="siteSettings"></param>
 public void UpdateWebSite(string webSpaceName, string siteName, WebSiteUpdateParameters siteSettings)
 {
     TestEasyLog.Instance.Info(string.Format("Updating web site '{0}'", siteName));
     WebSiteManagementClient.WebSites.UpdateAsync(webSpaceName, siteName, siteSettings, new CancellationToken()).Wait();
 }
 /// <summary>
 ///     Update website
 /// </summary>
 /// <param name="siteName"></param>
 /// <param name="siteSettings"></param>
 public void UpdateWebSite(string siteName, WebSiteUpdateParameters siteSettings)
 {
     UpdateWebSite(_webSpace, siteName, siteSettings);
 }
        /// <summary>
        /// Update the set of host names for a website.
        /// </summary>
        /// <param name="site">The site name.</param>
        /// <param name="hostNames">The new host names.</param>
        public void UpdateWebsiteHostNames(Site site, IEnumerable<string> hostNames)
        {
            var update = new WebSiteUpdateParameters();
            foreach (var name in hostNames)
            {
                update.HostNames.Add(name);
            }

            WebsiteManagementClient.WebSites.Update(site.WebSpace, site.Name, update);
        }
Exemple #10
0
 /// <summary>
 /// You can update the settings for a web site by using the HTTP PUT
 /// method and by specifying the settings in the request body.  (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/dn167005.aspx
 /// for more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.WebSites.IWebSiteOperations.
 /// </param>
 /// <param name='webSpaceName'>
 /// The name of the web space.
 /// </param>
 /// <param name='webSiteName'>
 /// The name of the web site.
 /// </param>
 /// <param name='parameters'>
 /// Parameters supplied to the Update Web Site operation.
 /// </param>
 /// <returns>
 /// The Update Web Site operation response.
 /// </returns>
 public static Task <WebSiteUpdateResponse> UpdateAsync(this IWebSiteOperations operations, string webSpaceName, string webSiteName, WebSiteUpdateParameters parameters)
 {
     return(operations.UpdateAsync(webSpaceName, webSiteName, parameters, CancellationToken.None));
 }
Exemple #11
0
 /// <summary>
 /// You can update the settings for a web site by using the HTTP PUT
 /// method and by specifying the settings in the request body.  (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/dn167005.aspx
 /// for more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.WebSites.IWebSiteOperations.
 /// </param>
 /// <param name='webSpaceName'>
 /// The name of the web space.
 /// </param>
 /// <param name='webSiteName'>
 /// The name of the web site.
 /// </param>
 /// <param name='parameters'>
 /// Parameters supplied to the Update Web Site operation.
 /// </param>
 /// <returns>
 /// The Update Web Site operation response.
 /// </returns>
 public static WebSiteUpdateResponse Update(this IWebSiteOperations operations, string webSpaceName, string webSiteName, WebSiteUpdateParameters parameters)
 {
     try
     {
         return(operations.UpdateAsync(webSpaceName, webSiteName, parameters).Result);
     }
     catch (AggregateException ex)
     {
         if (ex.InnerExceptions.Count > 1)
         {
             throw;
         }
         else
         {
             throw ex.InnerException;
         }
     }
 }
Exemple #12
0
 /// <summary>
 /// You can update the settings for a web site by using the HTTP PUT
 /// method and by specifying the settings in the request body.  (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/dn167005.aspx
 /// for more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.WebSites.IWebSiteOperations.
 /// </param>
 /// <param name='webSpaceName'>
 /// Required. The name of the web space.
 /// </param>
 /// <param name='webSiteName'>
 /// Required. The name of the web site.
 /// </param>
 /// <param name='parameters'>
 /// Required. Parameters supplied to the Update Web Site operation.
 /// </param>
 /// <returns>
 /// The Update Web Site operation response.
 /// </returns>
 public static WebSiteUpdateResponse Update(this IWebSiteOperations operations, string webSpaceName, string webSiteName, WebSiteUpdateParameters parameters)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((IWebSiteOperations)s).UpdateAsync(webSpaceName, webSiteName, parameters);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }