I have created a SPWebConfigModification with this script
$webApplication = Get-SPWebApplication -Identity $url
$WebApp = $WebApplication.Read()
$configMod = New-Object Microsoft.SharePoint.Administration.SPWebConfigModification
$configMod.Path = "configuration/system.web/httpRuntime"
$configMod.Name = "maxUrlLength"
$configMod.Sequence = 0
$configMod.Owner = "CustomHttpRuntime"
$configMod.Type = 1
$configMod.Value = "500"
$WebApp.WebConfigModifications.Add( $configMod )
$WebApp.Update()
$WebApp.Parent.ApplyWebConfigModifications()
On my O,T and A environment this is processed immediately. When I run this in my production environment nothing happens. When I run this script again I get the error
We have tried the solution mentioned here: https://social.msdn.microsoft.com/Forums/office/en-US/5bb97bf7-d15b-4f56-a9a4-eedf95001042/a-web-configuration-modification-operation-is-already-running-only-1-applywebconfigmodifications?forum=sharepointdevelopmentlegacy
But after 5 minutes the error is back when you try to execute the script again