Hello,
The Kentico setting I mentioned is the same you did in your first post:
CMS Site Manager -> Settings -> Cloud Services -> Show Windows Azure logoSince you confirmed that it is set to true, and since
SettingsHelper.AppSettings["CMSAzureProject"] returns an empty value, the issue seems to be with the Azure settings, not Kentico settings.
It is strange that the value is true in Azure UI, but empty when retrieving it from code. Could you also try retrieving some other settings key, using the same code? For example:
CMSAzureAccountName? Do you also receive empty value?
If so, could you test placing the CMSAzureProject key in the web.config and see if you can get it then?
Finally, have you made any changes to the project code files? Could you check that this particular file looks like this?
~\Old_App_Code\CMSModules\WindowsAzure\AzureInit.csusing System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using CMS.SettingsProvider;
using Microsoft.WindowsAzure.ServiceRuntime;
using Microsoft.WindowsAzure.StorageClient;
/// <summary>
/// Intitializes Windows Azure web role when its running using full IIS.
/// </summary>
public class AzureInit
{
#region "Variables"
private static AzureInit mCurrent = null;
private static object objLock = new object();
#endregion
#region "Properties"
/// <summary>
/// Returns Azure init object.
/// </summary>
public static AzureInit Current
{
get
{
if (mCurrent == null)
{
lock (objLock)
{
if (mCurrent == null)
{
mCurrent = new AzureInit();
}
}
}
return mCurrent;
}
}
#endregion
#region "Methods"
/// <summary>
/// Code executed on application starts.
/// </summary>
public void ApplicationStartInit()
{
AzureHelper.OnGetApplicationSettings += AzureHelper_GetApplicationSettings;
AzureHelper.CurrentInstanceID = RoleEnvironment.CurrentRoleInstance.Id;
AzureHelper.OnRestartRequired += AzureHelper_OnRestartRequired;
// Get path for Temp
LocalResource temp = RoleEnvironment.GetLocalResource("CMSTemp");
AzureHelper.TempPath = temp.RootPath;
// Get path for Cache
LocalResource cache = RoleEnvironment.GetLocalResource("CMSCache");
AzureHelper.CachePath = cache.RootPath;
// Get internal instance endpoints
foreach (var instance in RoleEnvironment.Roles["CMSApp"].Instances)
{
// Current instance id
if (instance.Id == RoleEnvironment.CurrentRoleInstance.Id)
{
// Set current internal endpoint
RoleInstanceEndpoint endpoint = instance.InstanceEndpoints["InternalHttpIn"];
AzureHelper.CurrentInternalEndpoint = "http://" + endpoint.IPEndpoint.ToString();
}
}
// Set Azure deployment
AzureHelper.DeploymentID = RoleEnvironment.DeploymentId;
// Set number of instances
AzureHelper.NumberOfInstances = RoleEnvironment.Roles["CMSApp"].Instances.Count;
}
/// <summary>
/// Code executed on BeginRequest event.
/// </summary>
public void BeginRequestInit()
{
}
/// <summary>
/// Reads settings from service configuration file.
/// </summary>
/// <param name="key">Setting key.</param>
string AzureHelper_GetApplicationSettings(string key)
{
try
{
return RoleEnvironment.GetConfigurationSettingValue(key);
}
catch
{
// Setting key was not found
return null;
}
}
/// <summary>
/// Restarts azure application.
/// </summary>
void AzureHelper_OnRestartRequired(object sender, EventArgs e)
{
RoleEnvironment.RequestRecycle();
}
#endregion
}