开发者

Saving Web.Config Changes using SPWebConfigurationModification in SharePoint 2010

I have seen numerous examples on some SharePoint blogs regarding the use of the SPWebConfigurationModification class to modify SharePoint's web.config.

However, I noticed some examples call the update method at different times. For example:

myWebApp.Update();

myWebApp.Farm.Services.GetValue<SPWebService>().ApplyWebConfigModifications(); 

Or

myWebApp.Farm.Services.GetValue<SPWebService>().ApplyWebConfigModifications();

myWebApp.Update(); 

Which is the correct way? The reason why I ask is because I get a "A web configuration modification operation is already running." error when deploying a custom page which requires modifications to the web.config to be made on load balanced server.

I am sure it is probably due to the fact that the web.config changes are not being saved correctly across mult开发者_Go百科iple farms.

Thanks for any help.


The correct order is ApplyWebConfigModifications() then Update(). Are you encapsulating that code in SPSecurity.RunWithElevatedPrivileges?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜