开发者

SQL Exception on immediate reconnect

I have a winform app that uses LinqToSql as it's DAL. There is a Central SQL DB and each laptop has a local SQLExpress DB. A seperate module, using Merge Replication, keeps the two in sync. When connection is lost to the central DB it 'fails over' to the local. This works great.

However, when I regain conection to the central db, if the time period has not been real long, I get the following exception -->

A transport-level error has occurred when sending the request to the server. (provider: TCP Provider, error: 0 - An existing connection was forcibly closed by the remote host.)

I have read through numerous posts here on SO relating to this and even this msdn article that outlines and explains, in great detail, what is going wrong yet, through all of this, I have still not found or read a solution.

I am wondering how others have dealt with this. I find it hard to believe that I am treading new ground here. Is there a way to remove my old connections on reconnect?

I am losing hair over this so any insight is ap开发者_开发技巧preciated.

EDIT

Also of note, I am quite positive that all my Data Contexts are wrapped in a using and I do not have any 'long-term' contexts.


Turning off Connection Pooling using the "Pooling=false" connection string attribute seems to have solved the problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜