appcmd pipelining - how to add ISAPI Filter to each site's web.config? [Answered]RSS

3 replies

Last post Oct 14, 2011 05:38 AM by London

  • appcmd pipelining - how to add ISAPI Filter to each site's web.config?

    Oct 07, 2011 11:11 PM|itisdesign|LINK

    Can appcmd.exe pipelining write an ISAPI Filter to each site's web.config?

    Currently, I can get the following list of sites using (I'll refer to this as Command1): C:\Windows\system32\inetsrv\appcmd.exe list site /xml

    <?xml version="1.0" encoding="UTF-8"?>
    <appcmd>
        <SITE SITE.NAME="Default Web Site" SITE.ID="1" bindings="http/*:80:" state="Started" />
        <SITE SITE.NAME="mysitecom" SITE.ID="2" bindings="http/*:80:www1.mysite.com" state="Started" />
    </appcmd>

    Also, I can write the following ISAPI Filter to a specific site's web.config using (I'll refer to this as Command2): C:\Windows\system32\inetsrv\appcmd.exe set config "mysitecom" /section:isapiFilters /+"[name='MyFilter',path='C:\my_filter.dll']"

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <isapiFilters>
                <filter name="MyFilter" path="C:\my_filter.dll" />
            </isapiFilters>
        </system.webServer>
    </configuration>

    Pipelining allows a command to be run for each item in a list.  Thus, it should allow Command2 to be run for each site returned by Command1, using the following pipelining command which joins Command1 and Command2 (I'll refer to this as Command3):  C:\Windows\system32\inetsrv\appcmd.exe list site /xml | C:\Windows\system32\inetsrv\appcmd.exe set config /in /section:isapiFilters /+"[name='MyFilter',path='C:\my_filter.dll']"

    However, Command3 is writing to applicationHost.config, instead of each site's web.config!

    Is it even possible to use appcmd pipelining to edit web.config files?

    TIA,
    -Aaron

  • Re: appcmd pipelining - how to add ISAPI Filter to each site's web.config?

    Oct 08, 2011 12:16 PM|itisdesign|LINK

    itisdesign


    However, Command3 is writing to applicationHost.config, instead of each site's web.config!

    Specifically, it is adding it to applicationHost.config as:

    <location path="" ...>
        <system.webServer>
            <isapiFilters>
                <filter name="MyFilter" path="C:\my_filter.dll" />
            </isapiFilters>
        </system.webServer>
    </location>

    The problem is the path="". It appears the "/in" is being disregarded in Command3. The "/in" in Command3 should cause the filter to be applied "locally" to each site. It'd also be fine if it was adding to applicationHost.config as:

    <location path="mysitecom">
        <system.webServer>
            <isapiFilters>
                <filter name="MyFilter" path="C:\my_filter.dll" />
            </isapiFilters>
        </system.webServer>
    </location>

    Note the site-specific path. That is what I am trying to achieve. But I want to pipe the list of sites (Command1) into the 'set config isapiFilters' (Command2), to write this Filter "locally" to each site (not "globally").

    I think the bigger question is: Can appcmd pipelining be used for site-specific config changes?

    Thanks,
    -Aaron

     

  • Re: appcmd pipelining - how to add ISAPI Filter to each site's web.config?

    Oct 08, 2011 12:25 PM|itisdesign|LINK

    itisdesign


    I think the bigger question is: Can appcmd pipelining be used for site-specific config changes?

    Meaning, does appcmd.exe's "set config" support the "/in" switch?

    Thanks,
    -Aaron

     

  • Re: appcmd pipelining - how to add ISAPI Filter to each site's web.config?

    Oct 14, 2011 05:38 AM|London|LINK

    Hi,

    The reason that I think it is not support here is:

    The supported parameters for "config" are "identifier" and "/section", and "identifier" is configuration path or url. The properties of object "app" or "site" does not apply to object "config",