/// <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 Task<WebSiteUpdateResponse> UpdateAsync(this IWebSiteOperations operations, string webSpaceName, string webSiteName, WebSiteUpdateParameters parameters)
 {
     return operations.UpdateAsync(webSpaceName, webSiteName, parameters, CancellationToken.None);
 }
예제 #2
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(Utilities.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);
        }
 /// <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();
 }
 private void SetWebsiteToStandard(string websiteName)
 {
     WebSiteUpdateParameters updateParameters = new WebSiteUpdateParameters();
     updateParameters.ServerFarm = WebsiteServerFarmName;
     updateParameters.HostNames = this.GetWebsiteHostNames(websiteName);
     WebsiteManagementClient.WebSites.Update(WebSpaceName, websiteName, updateParameters);
 }
예제 #5
0
 /// <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();
 }
예제 #6
0
 /// <summary>
 ///     Update website
 /// </summary>
 /// <param name="siteName"></param>
 /// <param name="siteSettings"></param>
 public void UpdateWebSite(string siteName, WebSiteUpdateParameters siteSettings)
 {
     UpdateWebSite(_webSpace, siteName, siteSettings);
 }
 /// <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;
         }
     }
 }
        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);
        }