Web.config Transform not working for SessionState or OutputCache elements

582 Views Asked by At

My original web config:

<sessionState mode="Custom" customProvider="SessionStateStore" timeout="5">
    <providers>
        <add name="SessionStateStore" throwOnError="false" type="Microsoft.Web.Redis.RedisSessionStateProvider" host="localhost" accessKey="sessionstate" port="6379" ssl="false" applicationName="ezimanager" connectionTimeoutInMilliseconds="30000" operationTimeoutInMilliseconds="30000" />
    </providers>
</sessionState>
<caching>
    <outputCache defaultProvider="RedisOutputCache">
        <providers>
<add name="RedisOutputCache" type="Microsoft.Web.Redis.RedisOutputCacheProvider" host="localhost" accessKey="outputcache" port="6379" ssl="false" connectionTimeoutInMilliseconds="30000" operationTimeoutInMilliseconds="30000" />
        </providers>
    </outputCache>
</caching>

I have tried xdt:Locator="XPath(/configuration/system.web/caching/outputCache)" on the element, and set attributes on the add elements. I've tried xdt:Transform="SetAttributes(host,accessKey,ssl,port)" xdt:Locator="Match(name)" on the add elements, or even just xdt:Transform="SetAttributes"

The current transform looks like:

<system.web>
    <sessionState mode="Custom" customProvider="SessionStateStore" timeout="5">
        <providers>
            <add name="SessionStateStore"
                throwOnError="false"
                type="Microsoft.Web.Redis.RedisSessionStateProvider"
                host="actualHost"
                accessKey="actualAccessKey"
                port="6380"
                ssl="true"
                applicationName="ezimanager"
                connectionTimeoutInMilliseconds="30000"
                operationTimeoutInMilliseconds="30000"
                xdt:Transform="SetAttributes(host,accessKey,ssl,port)"
                xdt:Locator="Match(name)" />
            </providers>
        </sessionState>
    <caching>
        <outputCache defaultProvider="RedisOutputCache">
            <providers>
                <add name="RedisOutputCache"
                    type="Microsoft.Web.Redis.RedisOutputCacheProvider"
                    host="actualHost"
                    accessKey="actualAccessKey"
                    port="6380"
                    ssl="true"
                    connectionTimeoutInMilliseconds="30000"
                    operationTimeoutInMilliseconds="30000"
                    xdt:Transform="SetAttributes(host,accessKey,ssl,port)"
                    xdt:Locator="Match(name)"/>
            </providers>
        </outputCache>
    </caching>
</system.web>

The only difference I have managed to affect is occasionally the transform fails completely. Otherwise no change occurs. What am I missing?

1

There are 1 best solutions below

0
shadowmaster13 On

Our web.config file has a <location path="." inheritInChildApplications="false"> element surrounding the system.web element