Revision #3

You are currently reviewing an older revision of this page.
Go to current version
​Before App Fabric 1.1  CU5 Installation : 

Stop the App Fabric Service gracefully by using below script.

PwerShell:

asnp *sh*
Stop-SPDistributedCacheServiceInstance -Graceful

Then Install the CU5, then Update the DistributedCacheService.exe.config located in the path " %ProgramFiles%\AppFabric 1.1 for Windows Server "  with below Key at bottom of the script. 


<appSettings><add key="backgroundGC" value="true"/></appSettings>

Scenario:  
We have put  config entry at the beginning of the config file. After that try to provision the DC, was not at all starting the App Fabric Service. As you know we cant start manually.
 
Error:

Microsoft.ApplicationServer.Caching.DataCacheException: ErrorCode<UnspecifiedErrorCode>:SubStatus<ES0001>:The type initializer for 'Microsoft.ApplicationServer.Caching.ServiceConfigurationManager' threw an exception. ---> System.TypeInitializationException: The type initializer for 'Microsoft.ApplicationServer.Caching.ServiceConfigurationManager' threw an exception. ---> System.TypeInitializationException: The type initializer for 'Microsoft.ApplicationServer.Caching.DataCacheServerLogManager' threw an exception. ---> System.TypeInitializationException: The type initializer for 'Microsoft.Fabric.Common.EventLogWriter' threw an exception. ---> System.Configuration.ConfigurationErrorsException: Configuration system failed to initialize ---> System.Configuration.ConfigurationErrorsException: Only one <configSections> element allowed per config file and if present must be the first child of the root <configuration> element. (C:\Program Files\AppFabric 1.1 for Windows Server\DistributedCacheService.exe.Config line 6) at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal) at System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(ConfigurationSchemaErrors schemaErrors) at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey) --- End of inner exception stack trace --- at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey) at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName) at Microsoft.Fabric.Common.ConfigFile.get_Config() at Microsoft.Fabric.Common.EventLogWriter.LoadSinkFromConfig() at Microsoft.Fabric.Common.EventLogWriter..cctor() --- End of inner exception stack trace --- at Microsoft.Fabric.Common.EventLogWriter.AddSink(IEventSink sink, Int32 defaultLevel) at Microsoft.ApplicationServer.Caching.DataCacheServerLogManager..cctor() --- End of inner exception stack trace --- at Microsoft.ApplicationServer.Caching.DataCacheServerLogManager.ChangeLogLevel(TraceLevel traceLevel) at Microsoft.ApplicationServer.Caching.ServiceConfigurationManager..cctor() --- End of inner exception stack trace --- at Microsoft.ApplicationServer.Caching.ServiceConfigurationManager..ctor() at Microsoft.ApplicationServer.Caching.VelocityWindowsService.StartService(Boolean deleteTKT) at Microsoft.ApplicationServer.Caching.VelocityWindowsService.OnStart(String[] args) --- End of inner exception stack trace --- at Microsoft.ApplicationServer.Caching.VelocityWindowsService.ThrowCallback(Object exception) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem() at System.Threading.ThreadPoolWorkQueue.Dispatch()


Solution : 

Change the config entry location to bottom and 

Provision the Distributed cache again using the Power Shell below


PowerShell: 

$instanceName ="SPDistributedCacheService Name=AppFabricCachingService"
$serviceInstance = Get-SPServiceInstance | ? {($_.service.tostring()) -eq $instanceName -and ($_.server.name) -eq $env:computername}
$serviceInstance.Provision()


Reference : 
http://support.microsoft.com/kb/2787717/en-us
http://www.wictorwilen.se/how-to-patch-the-distributed-cache-in-sharepoint-2013