如何删除sessionState sqlConnectionString重复

问题描述 投票:0回答:1

我在web.config的标准connectionStrings元素中有一组连接字符串

web.config中的sessionState元素指示在使用sql会话状态时使用sqlConnectionString属性。

这通常导致连接字符串在文件中的2个位置被复制,并且如果有人忘记更改这两个位置,则可能导致它们不同步。

我可以使用什么机制来删除这种重复?

示例配置:

<connectionStrings>
    <add name="IWouldLikeToUseThisConnectionStringForSessionState" value="..."
</connectionStrings>

<sessionState 
    mode="SQLServer" 
    allowCustomSqlDatabase="true"
    sqlConnectionString="DuplicatedConnectionStringHereAndCanGetOutOfSync"
    />
asp.net
1个回答
1
投票

处理这种情况的一种方法可能是使用Partioning,如here所述。

© www.soinside.com 2019 - 2024. All rights reserved.