Thursday, January 3, 2019

The underlying provider failed on Open

My head was going to explode over this error. I could connect to a database via SSMS and I could not interact with the database from a C# app in Visual Studio. What was different? This suggests it might be a transaction permissions thing. Maybe if the database connection is one of two being used in an orchestration of SQL across the two... maybe then you are in trouble. This would also explain the impossible to explain difference.

 
 

Addendum 1/4/2019: It turns out that Entity Framework 6 tries to open and close a database connection whenever it talks to a database and when this happens in a transaction you may have the permissions problem. The solution is to manually open a connection and hand that connection into the transaction.

No comments:

Post a Comment