Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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

2 Answers 2

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

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

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

 
discard

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.