Sqlconnection does not support concurrent transactions

I want to execute two transactions at the same time. Therefore, I gave MultipleActiveResultSet = false in the connection string, as indicated in the MSDN article. But after changing the connection string, I get "Target machine actively refused." I work with WCF.

Any ideas on this?

Thank.

+3
source share
4 answers

I got the impression that MARS is really only applicable to the special case of getting multiple one-time read-only datasets in one connection, but for ordinary operations there should be its own connections.

+4
source

Can you explain what you are trying to do, please?

( ). 2 /:

+2

Are you sure that the "target machine actively refused" is associated with parallel transactions?

This means that the unit is not listening on the port you are trying to talk to.

+1
source

I made this mistake:

SqlConnection Con=new SqlConnection(_myConString);
SqlTransaction tr=Con.CreateTransaction();
tr=Con.CreateTransaction();

Lines 2 and 3 create transactions. So I was getting an error. I fixed it and the problem is resolved.

Conclusion: a call to CreateTransaction before the transaction completes raises the above exception.

0
source

Source: https://habr.com/ru/post/1729685/


All Articles