Domanda

I have a small application with two parts:

  1. A configuration part which contacts the database to retrieve configuration data.
  2. A Data Importer part which uses the configuration to import data into the database.

The Data Importer is running in multiple threads using transactions on IsolationLevel.Snapshot

The configuration sql commands do not use any transactions.

The data importer cannot run at the same time as the configuration window is open.

My issue arises as follows:

1.Open the application and check the configuration. (enter the config window to spot check everything). 2.Run the Data Import. 3.Reopen the config window.

Upon reopening the config window after an Import I will receive an error from a DataReader saying that Snapshot isolation transaction failed accessing database... However this DataReader is created from a SqlConnection that does not have any transaction or IsolationLevel set on it at all.

If I restart the application I can reopen the configuration window without error.

Is .Net or SQLServer holding onto the IsolationLevel ?

Is there a way to change the IsolationLevel after it has been set without creating a new transaction for everything?

È stato utile?

Soluzione

I think that the isolation level is being carried over via the connection pool.

This is by design, as this kb article states.

There are ways to work around this as in specifying the transaction isolation level explicitly.

You might want to check out this article.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top