SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question

if (SPServer.LocalServerRole == SPServerRole.WebFrontEnd) { // Do your magic }

share|improve this answer
is there any way to identify the different WFE? – user4205 Apr 9 '12 at 9:33
Itereate through SPFarm.Servers and pick up all that matches (SPServer.Role == SPServerRole.WebFrontEnd) – SharePoint Dude Apr 9 '12 at 9:58
@SharePointDude, the problem is that SPWebConfigModification modifies web.config in all WFEs, @user4205 wants to modify only in specific. – Kai Apr 9 '12 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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.