TransactionScope throwing exception. I am using ASP.NET Core with Core 3.0.
I get following issue locally on Windows: "This platform does not support distributed transactions."
I would like to sync two databases and would like to use TransactionScope to get a consistent state in both databases.
When I deploy it to Azure using AppService and Azure Sql it works fine.
Normally it should work when I check this link with .net core 3.0. https://learn.microsoft.com/de-de/dotnet/api/system.transactions.transactionscope?view=netcore-3.0
Hope somebody can help me.
using (var scope = new TransactionScope())
{
-- database1
using (SqlConnection connection = new SqlConnection(connectionString_DB1))
{
using (System.Data.SqlClient.SqlCommand cmd = connection.CreateCommand())
{
....
connection.Open();
result = cmd.ExecuteNonQuery();
}
}
--database2
using (SqlConnection connection = new SqlConnection(connectionString_DB2))
{
using (System.Data.SqlClient.SqlCommand cmd = connection.CreateCommand())
{
....
connection.Open();
result = cmd.ExecuteNonQuery();
}
}
scope.Complete();
}