Skipping Folders while Provisioning with Web Farm Framework 2.0 for IIS 7

by Keith Newman

Web Farm Framework enables you to control the provisioning of selected folders using its default synchronization provider. The default behavior of the provider is to provision all the files and directories from the primary server to all secondary servers. However, by editing ApplicationHost.config file, you can cause the provider to skip folders that you select.

To see how this works, assume that you have Folder1 and Folder2 under Default Web Site and you want to sync only Folder2 and exclude Folder1.

To exclude folders from provisioning

  1. On the controller machine, open the ApplicationHost.config file. This is under the directory

    %windir%\System\inetsrv\config
    
  2. Under the applicationProvision element, add an entry to skip the directives as follows

    <webFarms>
        <webFarm serverAutoStart="false" name="Farm" enabled="true" adminUserName="{0}\administrator" adminPassword="pwd"  primaryServer="demo-primary">
            <server address="demo-primary" enabled="true" />
            <server address="demo-secondary" enabled="true" />
            <platformProvision syncPlatformFromPrimary="true" />
            <applicationProvision syncWebServerFromPrimary="true">
                <skipDirectives>
                    <skip name="folder1" skipDirective="objectName=dirPath,absolutePath=.*folder1.*" />
                </skipDirectives>
            </applicationProvision>
        </webFarm>
    </webFarms>
    
  3. When you save the changes, Web Farms Framework immediately picks up the changes from the configuration file and does application provisioning.

  4. Verify that the secondary servers provisioned only Folder2, and Folder1 was excluded.

  5. You can also skip binding as follows:

    <skip name="folder1" skipDirective="attributes.protocol=https" />
    
  6. Alternatively, you can sync a specific directory using the msdeploy command directly for each secondary server as follows:

    C:\>cmd.exe /c ""%ProgramFiles%\IIS\Microsoft Web Deploy\msdeploy.exe" -verb:sync -source:contentPath="Default Web Site",computerName=demo-primary -dest:contentPath="Default Web Site" -skip:objectName=dirPath,absolutePath=.*folder1.*"