Thursday, March 5, 2009

Apply SPWebConfigModifications Issue

Scenario:
I have wrote a feature long back regarding how to update the Web.config entry.
Yesterday left me a comment that he is getting error while using webApplication.ApplyWebConfigModifications() method.

Reason:
When I looked at his code, I realized he is calling ApplyWebConfigModifications() twice and that was the issue.

Actually when this method is called , SharePoint queue up the job of modifying web.config and you need to be patient ( specially in Farm environment , or with extended web applications ). Wait for few seconds before you can see the changes in Web.Config.

Also calling ApplyWebConfigModifications() in the code multiple time without putting a delay can create un-expected issues.

So handle it with care :-)

Article:
Making sharepoint webconfig changes manageable

0 comments: