Windows Azure In-Role Cache - WARNING: <SimpleSendReceiveModule> DeadServerCallback Called - c#

I have an Azure cloud service app that is comprised of a worker role (1 instance only) and a web role (multiple instances). The web role is also where the Microsoft.WindowsAzure.Caching's (version 2.2) in-role co-located cache cluster resides. I have Azure diagnostics set up and in my WadLogsTable I see this pair of warnings every few minutes in production:
WARNING: DeadServerCallback Called, Server URI: [net.tcp://100.74.158.31:20005], Underlying exception - ; TraceSource 'w3wp.exe' event
WARNING: DeadServerCallback: Matches My Server, Cleaning Pending Requests; TraceSource 'w3wp.exe' event
The net.tcp://100.74.158.31:20005 corresponds to one of the web roles. The warnings sporatically alternate between the web roles (i.e. sometimes it says net.tcp://100.74.158.51:20005).
Notice that there is nothing after "Underlying exception - ". There are also no related exceptions in the WadWindowsEventLogsTable (I know that Azure exception logging is working because I will occasionally see other exceptions in that table). I believe I've also turned on all the Caching diagnostics that I could.
So my issue is that I am seeing all these warnings but I don't know why and I don't know how to remedy the situation. It doesn't appear that these warnings are causing the app to crash, but still they are worrisome. Any help would be appreciated.
Here is my ServiceConfiguration.cscfg:
<?xml version="1.0"?>
<ServiceConfiguration serviceName="CloudService" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="3" osVersion="*" schemaVersion="2013-10.2.2">
<Role name="WebRole">
<Instances count="2" />
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="DefaultEndpointsProtocol=https;AccountName=XXXXX;AccountKey=XXXXX" />
<Setting name="Microsoft.WindowsAzure.Plugins.Caching.NamedCaches" value="{"caches":[{"name":"default","policy":{"eviction":{"type":0},"expiration":{"defaultTTL":10,"isExpirable":true,"type":2},"serverNotification":{"isEnabled":false}},"secondaries":0}]}" />
<Setting name="Microsoft.WindowsAzure.Plugins.Caching.DiagnosticLevel" value="3" />
<Setting name="Microsoft.WindowsAzure.Plugins.Caching.CacheSizePercentage" value="30" />
<Setting name="Microsoft.WindowsAzure.Plugins.Caching.ConfigStoreConnectionString" value="DefaultEndpointsProtocol=https;AccountName=XXXXX;AccountKey=XXXXX" />
<Setting name="Microsoft.WindowsAzure.Plugins.Caching.ClientDiagnosticLevel" value="3" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.Enabled" value="true" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountUsername" value="Me" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountEncryptedPassword" value="XXXXX" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountExpiration" value="2014-08-05T23:59:59.0000000-07:00" />
</ConfigurationSettings>
<Certificates>
<Certificate name="Microsoft.WindowsAzure.Plugins.RemoteAccess.PasswordEncryption" thumbprint="XXXXX" thumbprintAlgorithm="sha1" />
<Certificate name="www.myapp.com" thumbprint="XXXXX" thumbprintAlgorithm="sha1" />
</Certificates>
</Role>
<Role name="WorkerRole">
<Instances count="1" />
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Caching.ClientDiagnosticLevel" value="3" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.Enabled" value="true" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountUsername" value="Me" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountEncryptedPassword" value="XXXXX" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountExpiration" value="2014-08-05T23:59:59.0000000-07:00" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteForwarder.Enabled" value="true" />
<!-- For Windows Azure ServiceManagement. -->
<Setting name="SubscriptionId" value="XXXXX" />
<Setting name="ServiceManagementCertificateThumbprint" value="value="XXXXX" " />
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="DefaultEndpointsProtocol=https;AccountName=XXXXX;AccountKey=XXXXX" />
</ConfigurationSettings>
<Certificates>
<Certificate name="Microsoft.WindowsAzure.Plugins.RemoteAccess.PasswordEncryption" thumbprint="XXXXX" thumbprintAlgorithm="sha1" />
<!-- For Windows Azure ServiceManagement. -->
<Certificate name="ServiceManagementCertificate" thumbprint="thumbprint="XXXXX" " thumbprintAlgorithm="sha1" />
</Certificates>
</Role>
</ServiceConfiguration>
Here are pertinent parts of the Web.config of my web role:
<dataCacheClients>
<dataCacheClient name="default" connectionPool="true" useLegacyProtocol="false" isCompressionEnabled="false" maxConnectionsToServer="2">
<autoDiscover isEnabled="true" identifier="WebRole" />
</dataCacheClient>
</dataCacheClients>
<cacheDiagnostics>
<crashDump dumpLevel="Full" dumpStorageQuotaInMB="100" scheduledTransferPeriodInMinutes="5" />
</cacheDiagnostics>
Here are pertinent parts of the App.config of my worker role:
<dataCacheClients>
<dataCacheClient name="default" connectionPool="true" useLegacyProtocol="false" isCompressionEnabled="false" maxConnectionsToServer="2">
<autoDiscover isEnabled="true" identifier="WebRole" />
</dataCacheClient>
</dataCacheClients>
<cacheDiagnostics>
<crashDump dumpLevel="Full" dumpStorageQuotaInMB="100" scheduledTransferPeriodInMinutes="5" />
</cacheDiagnostics>
Additional notes:
I've probably tried every possible combination of attribute settings for both the <dataCacheClient> entries in the web role's
Web.config and worker role's App.config.
The cloud service has been upgraded to use Windows Azure Tools version 2.2.
I've Googled and found a few posts related to these warnings but it seems that most people only experienced this in the compute emulator, not on production like I am. Nevertheless, I've tried most of their suggested solutions and nothing has helped.

As long as you dont see any failures or timeouts or drop in quality of the service, you should be good. The deadserver callback should be just cleaning up old unused connections. To validate this hypothesis :
Do you have any other connection errors happening in verbose logging ? Can you see if the last request to this server was a long time back ? Do you have bursty traffic ?

Related

RoleEnvironment.GetConfigurationSettingValue is showing error

I have added azure project in my application and added database connection string values in the settings tag named "MasterDBConnection" under .cscfg file like below:
<Role name="projWorkerRole">
<Instances count="1" />
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="UseDevelopmentStorage=true" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.Enabled" value="true" />
<Setting name="MasterDBConnection" value="Server=u3oUIUIIY1v.database.windows.net;Database=ABCDTest;User ID=11;Password=rCVyqbcmSraLq8bjBXNcYyfPyvNqRu;Trusted_Connection=False;connection timeout=120;Max Pool Size = 500;Pooling = True;" />
<Setting name="StateDBConnection" value="Server=u3oUIUIIY1v.database.windows.net;Database=ASPState;User ID=relate;Password=rCVyqbcmSraLq8bjBXNcYyfPyvNqRu;Trusted_Connection=False;connection timeout=120;Max Pool Size = 500;Pooling = True;" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountUsername" value="abcd" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountEncryptedPassword" value="MMMMIIBSgIBADAyMB4xHDAaBgNVBAMME1dpbmRvd3MgQXp1cmUgVG9vbHMCEBoNpt+iYi+ZQhZlsYE7ZyIwDQYJKoZIhvcNAQEBBQAEggEAT5HQNweks5KCwtn5inNGrh7w4txgYA75ow/EB5DAmw4AozyKN6FoapXaGyizTU/U7Om+oUbad36IddxNZBp9dDCtS62HlDME8bCCc0tjrvViN0AX8p0l6wlTS0bh8bkZ6R18TbDrR8wnt/BZEkT0a8ynTeY9vYP8GwSNcqIoNSe6dThKeT/vmjqZYjDQrUcUhP7MwwIkhWyMk5svId2mkigHpkwUfCE2QsZh5Yau+eAIhbhy5LKgt/fPZec3fs21JPjZT2yOSQ4Nnagij1ITfG97EQqjl35mq0Es6Jy/BZXNgfF9XWD6zFnAL3t7vQ9Yb2gFRhsLiFh0pFq+E9a8ATAzBgkqhkiG9w0BBwEwFAYIKoZIhvcNAwcECHZXItflnlNUg..." />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountExpiration" value="2026-16-27T23:59:59.0000000+05:30" />
</ConfigurationSettings>
<Certificates>
<Certificate name="Microsoft.WindowsAzure.Plugins.RemoteAccess.PasswordEncryption" thumbprint="04A23427944E036103F686C4DD...." thumbprintAlgorithm="dha1" />
</Certificates>
</Role>
Now when I'm calling the connection string value from .cscfg file it's showing an error.
I'm calling the connection string like below:
string connMaster = RoleEnvironment.GetConfigurationSettingValue("MasterDBConnection");
The error is showing like below:
An exception of type 'Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironmentException' occurred in Microsoft.WindowsAzure.ServiceRuntime.dll but was not handled in user code
Additional information: error

Build fails on Team Services

I have a .NET Azure solution in Visual Studio 2015. The application uses 2 worker roles.
As part of it's functionality, at some point in the build process a couple of dlls are copied in to the cloud project so they end up in the end result.
To make it work I've added the following in "ServiceDefinition.csdef":
<WorkerRole name="SomeProject.Foreman" vmsize="Small">
<Contents>
<Content destination="ClientCustomCode">
<SourceDirectory path="ClientCustomCode" />
</Content>
</Contents>
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" />
<Setting name="SomeProjectDocumentDBURI" />
<Setting name="SomeProjectAuthorizationKey" />
<Setting name="LogLevel" />
<Setting name="RequestQueue" />
<Setting name="RequestErrorQueue" />
<Setting name="NumberOfConcurrentRequests" />
<Setting name="NumberOfRequestsToReadFromAzureQueue" />
<Setting name="StorageConnectionString" />
<Setting name="SomeProjectPnrHistory" />
<Setting name="SomeProjectClientRepository" />
<Setting name="SomeProjectMessagesInProcess" />
</ConfigurationSettings>
<LocalResources>
<LocalStorage name="InstallLogs" sizeInMB="5" cleanOnRoleRecycle="false" />
</LocalResources>
<Startup>
<Task commandLine="install.cmd" executionContext="elevated" taskType="simple">
<Environment>
<Variable name="PathToInstallLogs">
<RoleInstanceValue xpath="/RoleEnvironment/CurrentInstance/LocalResources/LocalResource[#name='InstallLogs']/#path" />
</Variable>
</Environment>
</Task>
</Startup>
</WorkerRole>
<WorkerRole name="SomeProject.Engine" vmsize="Small">
<Contents>
<Content destination="ClientCustomCode">
<SourceDirectory path="ClientCustomCode" />
</Content>
</Contents>
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" />
<Setting name="RequestQueue" />
<Setting name="RequestErrorQueue" />
<Setting name="SomeProjectDocumentDBURI" />
<Setting name="SomeProjectAuthorizationKey" />
<Setting name="LogLevel" />
<Setting name="NumberOfConcurrentRequests" />
<Setting name="NumberOfRequestsToReadFromAzureQueue" />
<Setting name="StorageConnectionString" />
<Setting name="SomeProjectPnrHistory" />
<Setting name="SomeProjectClientRepository" />
<Setting name="SomeProjectMessagesInProcess" />
</ConfigurationSettings>
<LocalResources>
<LocalStorage name="InstallLogs" sizeInMB="5" cleanOnRoleRecycle="false" />
</LocalResources>
<Startup>
<Task commandLine="install.cmd" executionContext="elevated" taskType="simple">
<Environment>
<Variable name="PathToInstallLogs">
<RoleInstanceValue xpath="/RoleEnvironment/CurrentInstance/LocalResources/LocalResource[#name='InstallLogs']/#path" />
</Variable>
</Environment>
</Task>
</Startup>
</WorkerRole>
In the cloud project I added the following in the build events:
-- Pre-build
IF NOT EXIST $(TargetDir)ClientCustSomCode mkdir $(TargetDir)ClientCustomCode
-- Post-build
IF NOT EXIST $(TargetDir)ClientCustomCode mkdir $(TargetDir)ClientCustomCode
copy $(ProjectDir)ClientCustomCode\*.dll $(TargetDir)ClientCustomCode
copy $(ProjectDir)ClientCustomCode\*.pdb $(TargetDir)ClientCustomCode
In the project file where the copied dll is actually build:
copy $(TargetName).dll $(SolutionDir)SomeProject\SomeProject.Cloud\ClientCustomCode
copy $(TargetName).pdb $(SolutionDir)SomeProject\SomeProject.Cloud\ClientCustomCode
Now, locally this builds with no problem. Until recently it also build on Team Services, but out of the blue, without any real reason (nothing was changed) the build suddenly started to fail with the following error:
2016-08-23T08:37:40.3013767Z C:\a\1\s\SomeStuff\SomeProject\SomeProject.Cloud\ServiceDefinition.csdef : error CloudServices089: Cannot find the source directory 'C:\a\1\s\SomeStuff\SomeProject\SomeProject.Cloud\ClientCustomCode' in role SomeProject.Foreman. [C:\a\1\s\SomeStuff\SomeProject\SomeProject.Cloud\SomeProject.Cloud.ccproj]
2016-08-23T08:37:40.3013767Z C:\a\1\s\SomeStuff\SomeProject\SomeProject.Cloud\ServiceDefinition.csdef : error CloudServices089: Cannot find the source directory 'C:\a\1\s\SomeStuff\SomeProject\SomeProject.Cloud\ClientCustomCode' in role SomeProject.Engine. [C:\a\1\s\SomeStuff\SomeProject\SomeProject.Cloud\SomeProject.Cloud.ccproj]
Build log file: Download
Does anyone here might have an idea?
error CloudServices089: Cannot find the source directory 'C:\a\1\s\SomeStuff\SomeProject\SomeProject.Cloud\ClientCustomCode' in role SomeProject.Foreman. [C:\a\1\s\SomeStuff\SomeProject\SomeProject.Cloud\SomeProject.Cloud.ccproj]
The install.cmd is used to create directory and copy assemblies to the new directory. From the error message, I think the install.cmd is not executed. Maybe the install.cmd does not deploy to worker role. Please verify via enable Remote desktop when publish the application:
We could find the install.cmd in the directory E:\approot in worker role instance.
Please try to find install.cmd in your solution, then set the Copy to Output Directory as Copy always to see whether it works, like following:

CloudConfigurationManager.GetSetting() returns null with Azure Configuration Manager 3.0

I just upgraded (via nuget) to the latest version of the Azure Configuration Manager (3.0.0):
https://www.nuget.org/packages/Microsoft.WindowsAzure.ConfigurationManager/3.0.0
Once I did that - and made a few namespace adjustments - it looks like it has stopped returning values for my Azure Worker Role configuration.
I'm retrieving a connection string value like this:
var storageCs = CloudConfigurationManager.GetSetting("Microsoft.Storage.ConnectionString");
My service definition file looks like this:
<?xml version="1.0"?>
<ServiceDefinition name="Payboard.Worker" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2014-06.2.4">
<WorkerRole name="Payboard.Worker.Events" vmsize="Small">
<ConfigurationSettings>
<Setting name="Microsoft.Storage.ConnectionString" />
<Setting name="PayboardEntities" />
<Setting name="cacheSystem" />
<Setting name="Microsoft.WindowsAzure.Plugins.Caching.ClientDiagnosticLevel" />
<Setting name="redisCacheConnectionString" />
</ConfigurationSettings>
<Imports>
<Import moduleName="RemoteAccess" />
<Import moduleName="RemoteForwarder" />
</Imports>
<Startup priority="-2">
</Startup>
</WorkerRole>
</ServiceDefinition>
And my service configuration file like so (with sensitive information removed):
<?xml version="1.0"?>
<ServiceConfiguration serviceName="Payboard.Worker" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="4" osVersion="*" schemaVersion="2014-06.2.4">
<Role name="Payboard.Worker.Events">
<Instances count="1" />
<ConfigurationSettings>
<Setting name="Microsoft.Storage.ConnectionString" value="UseDevelopmentStorage=true" />
<Setting name="PayboardEntities" value="(standard connection string stuff)" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.Enabled" value="true" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountUsername" value="ken" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountEncryptedPassword" value="(encrypted password)" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountExpiration" value="2015-06-19T23:59:59.0000000-07:00" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteForwarder.Enabled" value="true" />
<Setting name="cacheSystem" value="simple" />
<Setting name="Microsoft.WindowsAzure.Plugins.Caching.ClientDiagnosticLevel" value="1" />
<Setting name="redisCacheConnectionString" value="(redis connection string)" />
</ConfigurationSettings>
<Certificates>
<Certificate name="Microsoft.WindowsAzure.Plugins.RemoteAccess.PasswordEncryption" thumbprint="(blah)" thumbprintAlgorithm="sha1" />
</Certificates>
</Role>
</ServiceConfiguration>
All of this worked correctly under 2.0.3, and indeed, works correctly if I revert back to 2.0.3. But any call to CloudConfigurationManager.GetSetting() returns null under 3.0.
I haven't found any documentation about what's supposedly changed under 3.0. Anybody have any suggestions? Is this just a bug of some sort? (Obviously I'm sticking at 2.x for now - no compelling reason to get to 3.0 - but I like sticking with the latest versions of stuff as a general rule.)
This is fixed in the newly published version 3.1.0.
Cheers,
Ogail
This is because a class called AzureApplicationSettings that loads the ServiceRuntime is looking for an assembly called Microsoft.Azure.ServiceRuntime (see below). The current version in the 2.5 sdk still has the old name (Microsoft.WindowsAzure). This assembly (at least, in the past) has not been provided through nuget but instead ships with the SDK. There is a big Azure announcement next week (3/24/15) so possibly we'll get a new SDK at that time. The various Azure groups have so far been working out the kinks of exactly how to push time coordinated releases that are interdependent on each other.
private readonly string[] knownAssemblyNames = new string[]
{
"Microsoft.Azure.ServiceRuntime, Culture=neutral, PublicKeyToken=31bf3856ad364e35, ProcessorArchitecture=MSIL"
}

Azure Diagnostics won't create WADLogsTable

I wanted to add logging to an existing azure cloud service using NLog and Azure Diagnostics, i went through all the steps described here: http://msdn.microsoft.com/en-us/library/azure/dn482131.aspx
But, unfortunately when testing the cloud service the WADLogsTable table storage does not created, and no information gets stored here. Not on local development storage, nor on azure.
diagnostics.wadcfg:
<?xml version="1.0" encoding="utf-8"?>
<DiagnosticMonitorConfiguration configurationChangePollInterval="PT1M" overallQuotaInMB="4096" xmlns="http://schemas.microsoft.com/ServiceHosting/2010/10/DiagnosticsConfiguration">
<DiagnosticInfrastructureLogs />
<Directories>
<IISLogs container="wad-iis-logfiles" directoryQuotaInMB="1024" />
<CrashDumps container="wad-crash-dumps" />
</Directories>
<Logs bufferQuotaInMB="1024" scheduledTransferPeriod="PT1M" scheduledTransferLogLevelFilter="Verbose" />
<PerformanceCounters bufferQuotaInMB="512">
<PerformanceCounterConfiguration counterSpecifier="\Memory\Available MBytes" sampleRate="PT3M" />
</PerformanceCounters>
<WindowsEventLog bufferQuotaInMB="1024" scheduledTransferPeriod="PT1M" scheduledTransferLogLevelFilter="Verbose">
<DataSource name="Application!*" />
</WindowsEventLog>
</DiagnosticMonitorConfiguration>
ServiceConfiguration.Local.csfg (the same at Cloud, just with the correct table storage account)
<?xml version="1.0" encoding="utf-8"?>
<ServiceConfiguration serviceName="AAService" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="4" osVersion="*" schemaVersion="2014-01.2.3">
<Role name="Web.Services.AAService">
<Instances count="1" />
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="UseDevelopmentStorage=true" />
</ConfigurationSettings>
</Role>
</ServiceConfiguration>
ServiceDefinition.csdef
<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="AAService" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2014-01.2.3">
<WebRole name="Web.Services.AAService" vmsize="ExtraSmall">
<Sites>
<Site name="Web">
<Bindings>
<Binding name="Endpoint1" endpointName="Endpoint1" />
</Bindings>
</Site>
</Sites>
<Endpoints>
<InputEndpoint name="Endpoint1" protocol="http" port="80" />
</Endpoints>
<Imports>
<Import moduleName="Diagnostics" />
</Imports>
<LocalResources>
<LocalStorage name="Web.Services.AAService.svclog" sizeInMB="1000" cleanOnRoleRecycle="false" />
</LocalResources>
</WebRole>
</ServiceDefinition>
WebRole entrypoint
public override bool OnStart()
{
// To enable the AzureLocalStorageTraceListner, uncomment relevent section in the web.config
DiagnosticMonitorConfiguration diagnosticConfig = DiagnosticMonitor.GetDefaultInitialConfiguration();
diagnosticConfig.Directories.ScheduledTransferPeriod = TimeSpan.FromMinutes(1);
diagnosticConfig.Directories.DataSources.Add(AzureLocalStorageTraceListener.GetLogDirectory());
DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString", diagnosticConfig);
// For information on handling configuration changes
// see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.
return base.OnStart();
}
cloud service web.config also has:
<system.diagnostics>
<trace>
<listeners>
<add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="AzureDiagnostics">
<filter type="" />
</add>
</listeners>
</trace>
</system.diagnostics>
Does anyone have any ide why is this doesnt make any trace logs? I called Trace.WriteLine() many places where the application goes through for sure, but still no WADLogsTable.
Thanks for the help
Get rid of all the Diagnostic* code in OnStart. The <Import moduleName="Diagnostics" /> in your csdef will automatically start the diagnostics agent, and the diagnostics agent will read the settings from the .wadcfg. Your code in OnStart is unnecessary and is overriding the wadcfg settings due to the order of precedence of loading WAD configuration.
Also note that if you are trying to update an existing cloud service then you will need to first delete the XML file in blob storage. If a file already exists in blob storage then the diagnostics agent will ignore the .wadcfg settings. The file you are looking for is in wad-control-container and will be named with the deployment ID and role name.

Read azure ServiceConfiguration file's certificate section using c#

Can we read certificate section withi ServiceConfiguration.cscfg file using c#? There is method inside RoleEnvironment class to read ConfigurationSettings, but not certificate section.
<?xml version="1.0" encoding="utf-8"?>
<ServiceConfiguration serviceName="WindowsAzureProject7" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="1" osVersion="*">
<Role name="MvcWebRole1" >
<Instances count="1" />
<Certificates>
<Certificate name="Microsoft.WindowsAzure.Plugins.RemoteAccess.PasswordEncryption" thumbprint="625FBBB3B7A25C4B9D1C49D1CB1E3AE196C1A083" thumbprintAlgorithm="sha1" />
</Certificates>
</Role>
</ServiceConfiguration>
Yes, there is no API to read certificate details as far as i know, however what you can do is create a configuration setting and add your certificate specific details and read it directly from the same API. Here is the trick, I used in past:
<ServiceConfiguration serviceName="RW" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration">
<Role name="RR">
<Instances count="1" />
<ConfigurationSettings>
<Setting name="AppFolder" value="RailsApp" />
<Setting name="CertificateThumb" value="*************" />
</ConfigurationSettings>
<Certificates>
<Certificate name="Microsoft.WindowsAzure.Plugins.RemoteAccess.PasswordEncryption" thumbprint="*****************************" thumbprintAlgorithm="sha1" />
</Certificates>
</Role>
</ServiceConfiguration>
Now, in my role specific code, I can call RoleEnvironment.GetConfigurationSettingValue to get the certificate thumb as below:
string certThumb = RoleEnvironment.GetConfigurationSettingValue("CertificateThumb");

Categories