Have you ever thought about how SharePoint handles web.config changes? Honestly I haven’t put much attention to it either, until I recently where involved in joining a new Web Front End server to a farm. The Web Applications that was on the farm had a few customizations in the web.config file added programmatically using the SPWebConfigModification class. But there were also one setting that was added manually.
There is a big difference in how this is handled within SharePoint. Because if you do it through the API, all changes become “SharePoint aware” in the sense that all those entries are not only added to all web.config file on all the WFE servers but it is actually added to the config db (Objects table). So when in this case adding a new server, SharePoint takes the web.config template and then pulls the customized entries from the config db. Any manually added entries will therefor not be provisioned out to the new WFE server.
The entries added to web.config through the API can be found in the object table and if you want, you can make the following query against the table in SQL Server Management Studio to see all the entries you have.
Select * from dbo.objects nolock where name like ‘webconfigchanges%’
So a best practice is to always use the API to make changes in web.config and if something is not possible to add programmatically into it, make sure to document it properly.
Mark Wagnar has written an excellent post with more information on how to modify the web.config using the SPWebConfigModification class found here: http://www.crsw.com/mark/Lists/Posts/Post.aspx?ID=32







It‘s quiet in here! Why not leave a response?