As per my understanding SPWebConfigModification class modifies the web.config across the farm, including all WFE. Are there any workaround to set some WFE specific web.config setting, like licence key or something using the above class
2 Answers
if (SPServer.LocalServerRole == SPServerRole.WebFrontEnd) { // Do your magic }
-
-
Itereate through SPFarm.Servers and pick up all that matches (SPServer.Role == SPServerRole.WebFrontEnd) Commented Apr 9, 2012 at 9:58
-
@SharePointDude, the problem is that
SPWebConfigModification
modifiesweb.config
in all WFEs, @user4205 wants to modify only in specific. Commented Apr 9, 2012 at 12:35
I politely disagree with SharePoint Dude because using SPWebConfigModification class requires submitting the modifications to the Content Service which applies the modifications across all web applications. That approach wont work.
I would suggest using a something external to SP to modify the web.config in that approach, i.e. PowerShell remoting and then transform the web.config file using WebConfigurationManager class directly.