I have a C# ASP.NET web app running on two machines behind a load balancer. We use sticky sessions so we do not have a shared out of process session state. Our code makes use of a SQL database and we process credit cards.
We need to synchronize execution of a block of code that checks conditions in the database and also attempts to charge a credit card. Checking the conditions and executing the credit card transaction must take place in the same synchronized block.
The only solution we have come up with is to move this block of code into a web service and call that web service from the machines. This presents two issues..
1) Fairly complicated data must be managed and returned by the web services 2) The web service will become another point of failure that can't be made redundant.
Any tools or frameworks out there to help synchronize code running on different machines?