“The operation is not valid for the state of the transaction” error and transaction scope

后端 未结 6 849
轮回少年
轮回少年 2020-12-02 14:13

I am getting the following error when I try to call a stored procedure that contains a SELECT Statement:

The operation is not valid for the state of t

6条回答
  •  伪装坚强ぢ
    2020-12-02 14:49

    For any wanderer that comes across this in the future. If your application and database are on different machines and you are getting the above error especially when using TransactionScope, enable Network DTC access. Steps to do this are:

    1. Add firewall rules to allow your machines to talk to each other.
    2. Ensure the distributed transaction coordinator service is running
    3. Enable network dtc access. Run dcomcnfg. Go to Component sevices > My Computer > Distributed Transaction Coordinator > Local DTC. Right click properties.
    4. Enable network dtc access as shown.

    Important: Do not edit/change the user account and password in the DTC Logon account field, leave it as is, you will end up re-installing windows if you do.

提交回复
热议问题