我们为 WCF 实现了数据库镜像,并在连接字符串中设置了故障转移伙伴,如下所示
....Data Source=10.0.13.21,1433;Failover Partner=10.0.13.31,1433; ...
10.0.13.21 - primary server
10.0.13.31 - secondary server
,但不知怎的,我们得到了错误:
底层提供者失败
当主服务器处于故障转移状态并且应用程序应该连接到辅助服务器时, 。重置 IIS 后一切恢复正常。
另一个奇怪的事情是,从辅助服务器切换回主服务器可以正常工作,但从主服务器切换到辅助服务器却不起作用。
有人知道这可能的原因吗?
提前致谢
We implemented database mirroring for WCF and set up failover partner in connectionstring as following
....Data Source=10.0.13.21,1433;Failover Partner=10.0.13.31,1433; ...
10.0.13.21 - primary server
10.0.13.31 - secondary server
but somehow we get error:
the underlying provider failed
when the primary server is in failover state and the application is supposed to connect to secondary server. Everything works again after resetting IIS.
Another strange thing is that the switch from secondary back to primary server is working but not from primary to secondary.
Anybody knows possible reason for this?
thanks in advance
发布评论
评论(1)
我认为您必须完全关闭应用程序中的连接,并且可能执行一些重试代码。清除连接池可能也是必要的。
另请记住,根据镜像重做队列的大小,故障转移伙伴数据库再次可用之前可能会有延迟。
这是我会阅读的几个链接 http://www.sqlskills.com/BLOGS/PAUL/post/A-SQL-Server-DBA-myth-a-day-(1130)-database-mirroring-failover-is-instantaneous。 aspx
和 http://technet.microsoft.com/en-us/library/cc917713.aspx
I think you have to completely close your connection in the application and maybe do some retry code. Clearing connection pools may also be necessary.
And also bear in mind that depending upon the size of the redo queues for the mirroring there may be a delay before the failover partner database is available again.
Here's a couple of links which I would read http://www.sqlskills.com/BLOGS/PAUL/post/A-SQL-Server-DBA-myth-a-day-(1130)-database-mirroring-failover-is-instantaneous.aspx
and http://technet.microsoft.com/en-us/library/cc917713.aspx