I have been using the SPWebConfigModification class for a while, and every now and then I hit the issue that when I attempt to activate a feature that modifies the web.config file I get the following error:
A web configuration modification operation is already running. at Microsoft.SharePoint.Administration.SPWebService.ApplyWebConfigModifications()
The biggest issue here is that I can no longer activate any other features that are going to edit the web.config, BIG PROBLEM! So with some investigation here is what I have found that will allow you to overcome this issue. Open your SharePoint Central Admin site, click on the Operations tab and click on the Job Definitions link under the Global Configuration heading. Here you will see a number of Timer Jobs that execute Daily, Disabled, Hourly, Mintues, etc. Here we are looking for a timer job titled Windows SharePoint Services Web.Config Update which executes One Time and will have an N/A listed for the Web Application. If you click on the title you will be directed to the Edit Timer Job page. This page provides you with three options, Delete, OK, Cancel. You can probably guess the next step, but before I confirm let me provide a warning. BY DELETING THE TIMER JOB BAD THINGS COULD HAPPEN! Now, go ahead and delete the timer job. You should now be able to activate your feature.
Here are a few blogs about how to properly deploy and activate features that should help you avoid this issue.
- Daniel Larson’s Developer Blog http://daniellarson.spaces.live.com/blog/cns!D3543C5837291E93!954.entry
- Tony Bierman http://sharepointsolutions.blogspot.com/2006/12/using-spwebconfigmodificat_116736917110571614.html