views:

34

answers:

1

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

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.

+1  A: 

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

Coding Gorilla