3

I have installed Sitecore Commerce 8.2.1 in our DEV environment. The database is in a remote server.

When we click on the "Add to cart" button it throws these exceptions:

[SQL:block:addlistentities.Exception: The operation is not valid for the state of the transaction.]

[SQL:block:persistentity.Insert.Exception: The operation is not valid for the state of the transaction.]

It works fine on my local system which has the database in the same box.

I have tried these steps from article to configure MSDTC in the application server but without luck.

7
  • 1
    Are you on Azure by any chance? If yes, you need to turn off transactions to make it work Jun 20 '18 at 8:25
  • @PeterProchazka No. Not on Azure
    – Qwerty
    Jun 20 '18 at 8:28
  • It could be issue of firewall. You should use DTCPing tool to check if both machines are able to reach each other Jun 20 '18 at 8:31
  • 1
    You can try to turn off transactions to check whether this is causing you trouble -> commercesdn.sitecore.net/SCpbCS82/… Jun 20 '18 at 8:32
  • @PeterProchazka But I am able to browse the CMS, whose databases (core, master, web) are also in the same remote server. Should I still use the ping tool?
    – Qwerty
    Jun 20 '18 at 8:32
2

You have three options here how to resolve this problem:

  • If you are not using Azure SQL, Sitecore recommends to turn on MSDTC on all servers. See option a) below.

  • If you are using Azure SQL, you can disable transactions. See option b).

  • If you are using Azure SQL, you have also other option and that it to enable MS Azure SQL databases with Commerce Server. See more information in this KB article with title "Running Sitecore Commerce 8.2.1 with Microsoft Azure SQL databases ". Please note that, as it's stated in the article, "Sitecore currently provides experimental support for Azure SQL and Sitecore Commerce 8.2.1 compatibility".

You don't need to do any of these options if both SQL Server and Commerce server are on same machine like on your local dev machine.

a) Enabling transactions

DTC should be enabled in the security configuration for MSDTC using the Component Services Administrative tool. You will need to enable MSDTC on all servers running Commerce Server, as well as the SQL Server unless SQL Server and Commerce Server are running on the same machine.

To enable DTC, please perform the following steps:

  1. Click Start > Run, type dcomcnfg, and then click OK to open Component Services.
  2. In the console tree, click to expand Component Services, click to expand Computers, click to expand My Computer, and then click to expand Distributed Transaction Coordinator.
  3. Right-click Local DTC, and then click Properties to display the Local DTC Properties dialog box.
  4. Click the Security tab.
  5. In the Security Settings section, click Network DTC Access.
  6. In the Client and Administration section, select Allow Remote Clients and Allow Remote Administration.
  7. In the Transaction Manager Communication section, select Allow Inbound and Allow Outbound.
  8. In the Transaction Manager Communication section, select Mutual Authentication Required, and select Incoming Caller Authentication Required if you are running MSDTC in a cluster. No Authentication Required is the recommended selection.
  9. Select Enable XA Transactions, and then click OK.
  10. Repeat steps 1 through 9 on the other Web servers.

Use DTCPing.exe to validate the connection between the Web server and the computer that is running SQL Server or an SQL cluster depending on your configuration. To obtain the DTCPing.exe tool, go to http://go.microsoft.com/fwlink/?LinkId=72166.

For more information about how to troubleshoot MSDTC, go to http://go.microsoft.com/fwlink/?LinkId=72203 https://blogs.msdn.microsoft.com/asiatech/2011/03/01/how-to-troubleshoot-msdtc-communication-failure-ii/

Also, please take a look at the following articles regarding enabling DTC: https://msdn.microsoft.com/en-us/library/dd327979.aspx

For more details regarding Microsoft Distributed Transaction Coordinator (MSDTC), please take a look at the following articles:

b) Disabling transactions

You can also disable transactions by setting this in json config for COmmerce Engine:

{ "$type":  "Sitecore.Commerce.Core.TransactionsPolicy, Sitecore.Commerce.Core",
     "TransactionalityEnabled":  false
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.