如何在运行时更改SQLServer模式下sessionState的sqlConnectionString?

发布于 2024-09-25 17:48:58 字数 799 浏览 0 评论 0原文

我们正在尝试找到一种在运行时更改 sessionState 的 sqlConnectionString (在 SQLServer 模式下)的方法。我们正在为 SQL 服务器实现故障转移,我们希望捕获 sessionState 无法访问我的 SQL 服务器的情况,并告诉它故障转移到我的辅助服务器并同时初始化站点范围的故障转移。

如果我不清楚,请随时询问我更多详细信息。 (顺便说一句,我们使用的是 C#)

编辑:为了确定,我说的是 sessionState,而不是常规的 sql 服务器连接,请参阅 http://msdn.microsoft.com/en-us/library/h6bb9cz9(vs.71).aspx

我当前的 web.config 是这样构建的:

<configuration>
    [...]   
<system.web>
    [...]
    <sessionState mode="SQLServer" timeout="525600" sqlConnectionString="Data Source=localhost\SQLEXPRESS;User ID=myUser;password=myPassword" cookieless="false"/>
</system.web>
[...]
</configuration>

希望这有帮助。

We're trying to find a way to change the sessionState's sqlConnectionString (in SQLServer mode) at runtime. We're implementing a fail over for our SQL server and we want to catch when the sessionState fails to have access to my SQL server and tell it to fail over to my secondary server and initialize the site-wide fail over at the same time.

If I'm not clear please feel free to ask me more details. (BTW we're using C#)

Edit: Just to be sure, I'm talking about sessionState and not regular sql server connections see http://msdn.microsoft.com/en-us/library/h6bb9cz9(vs.71).aspx.

My current web.config is built like this :

<configuration>
    [...]   
<system.web>
    [...]
    <sessionState mode="SQLServer" timeout="525600" sqlConnectionString="Data Source=localhost\SQLEXPRESS;User ID=myUser;password=myPassword" cookieless="false"/>
</system.web>
[...]
</configuration>

Hope this helps.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

铃予 2024-10-02 17:48:58

根据您管理连接的方式,您可以在 SQL Server 连接字符串中指定镜像服务器的故障转移伙伴:(

Data Source=myServerAddress;
Failover Partner=myMirrorServerAddress;
Initial Catalog=myDataBase;
Integrated Security=True;

来自 此处

Depending on how you're managing your connection, you can specify a mirrored server's failover partners in a SQL server connection string:

Data Source=myServerAddress;
Failover Partner=myMirrorServerAddress;
Initial Catalog=myDataBase;
Integrated Security=True;

(from here)

む无字情书 2024-10-02 17:48:58

根据我正在阅读的内容 [在这里]您可以创建一个partitionResolverType来让您在运行时控制连接字符串。我还没有验证它,但我目前正在寻找对连接字符串的相同控制,这看起来可能可以解决问题。

Based on what I am reading [here] you could create a partitionResolverType to give you control over the connection string at runtime. I have not verified it, but I am currently looking for the same control over the connection string and this looks like it may do the trick.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文