Web.config转换不适用于SessionState或OutputCache元素

时间:2019-10-08 23:25:30

标签: asp.net azure redis web-config-transform

我原来的网络配置:

<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>

我在元素上尝试过xdt:Locator="XPath(/configuration/system.web/caching/outputCache)",并在add元素上设置了属性。 我在添加元素上尝试过xdt:Transform="SetAttributes(host,accessKey,ssl,port)" xdt:Locator="Match(name)",甚至尝试过xdt:Transform="SetAttributes"

当前变换如下:

<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>

我设法影响的唯一区别是偶尔转换会完全失败。否则,不会发生任何变化。我想念什么?

1 个答案:

答案 0 :(得分:0)

我们的web.config文件的system.web元素周围有一个<location path="." inheritInChildApplications="false">元素