1

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

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

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spserver.localserverrole.aspx

3
  • 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) 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. Apr 9 '12 at 12:35
1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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