Impersonate session security context error without applying impersonation

Josué Zatarain 1 Reputation point
2021-01-22T17:27:29.843+00:00

Hi,

So I have an app that creates a SQL connection with MARS enabled and also impersonation, but it doesn't do calls in more than one thread (legacy system), and that app calls a service that also creates a SQL connection with MARS enabled, but without applying impersonation, and that service can run concurrent batches (multiple queries at the same time).

The thing is, that the service is getting the error: "Impersonate Session Security Context" cannot be called in this batch because a simultaneous batch has called it.

Could that be a bug with SQL server trying to join connections or something? The connections in that service are new, so it doesn't make sense to me that an impersonation error appears.

SQL server 2017 - .net framework 4

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,926 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,408 questions
{count} votes