Reputation: 255
I'm working on a site with several apps and services with EF and the database is throwing the following error:
The server will drop the connection, because the client driver has sent multiple
requests while the session is in single-user mode. This error occurs when a client
sends a request to reset the connection while there are batches still running in
the session, or when the client sends a request while the session is resetting
a connection. Please contact the client driver vendor.
So I searched on my connections strings for each app and service to ensure that MultipleActiveResultSets was enabled, and in all connections is enabled.
So run the following query
SELECT
c.session_id, c.net_transport,
s.host_name,
s.login_name
, c.connect_time
FROM sys.dm_exec_connections AS c
JOIN sys.dm_exec_sessions AS s
ON c.session_id = s.session_id
ORDER BY login_name
And see that I've for the same Login_name (same app) has multiple connections, but some connections have TCP net_transport and others "session", for the same login_name (same connection string)
What could cause that some connections use TCP instead of Session?
EDIT: This query returns for example:
session_id net_transport host_name login_name connect_time
196 TCP P3417722 UserName 2015-01-05 08:57:58.437
196 SESSION P3417722 UserName 2015-01-05 08:57:58.437
.
.
.
Notice that both have the same session_id and the same connect_time.
This means that I've two connections with the same username but one is with "Mars" enabled and the other doesn't?
Upvotes: 2
Views: 1142
Reputation: 1
Yep, i see that all the time on my servers.
Some frameworks (EF6, LINQ) can have TCP and SESSION connections at the same time, due to usage of connection pooling techniques.
My pet pieve is that Session should be TCP+MARS ;)
Upvotes: 0