Wednesday, 6 March 2013

“A web.config modification operation is already running” error in SharePoint 2010

It is pretty common that most of the enterprises do customize the SharePoint platform to a great extent by deploying solutions (WSPs) to the farm and associating features to those WSPs. When a feature is getting de-activated or activated, a web.config file change is triggered in the from of a timer job. This happens for almost all such operations. The file modification is done by an internally created timer job. It shows up as ‘job-webconfig-modification” when you execute the following command in SharePoint snap in loaded PowerShell console.

Get-SPTimerJob –Webapplication <ApplicationName>

There is another place where you can see the same timer job in “Run once” state. It is the Central Administration –> Monitoring –> Timer Jobs section. The job name should be visible as “Microsoft SharePoint Foundation web.config modification” job. This job should come up in the running job list for a while and then disappear as it gets removed after the modifications are done. As mentioned before, this is a run once job.

Getting into the problems, sometimes while activating or deactivating the features, you might receive this error (which is understandable from ULS logs) that a web.config modification is already running and this operation cannot be completed. This can be because you are trying to deactivate or activate features so quickly that you are not giving SharePoint the necessary time to complete its previous action. In some cases, although your previous action is complete a long time back, this still gives the same error. When I faced this error, I had no clue about what is happening because there is no feature activation deactivation that I did earlier nor I see the timer job in the PowerShell console. However I have learnt that the “Microsoft SharePoint Foundation web.config modification” job in Central Administration is present the job definition list and its schedule is stated as “Disabled”. I was not sure why it was not deleted after the feature deactivation/activation activity that I did before. It just remained there in the list disabled and it was stopping me from doing the current operation of activating features. I cannot take any action on that job except for leaving it like that DELETE it. I deleted the job and my current operation of feature activation and deactivation is now working :-).

So in case you are having similar issue and find such scrap job in your scheduled timer jobs list, please go ahead and delete it if it is in disabled state. This should work. I hope it helps and thanks for reading.

No comments: