Looking at your connection string, it looks valid. I found this blog post, the problem here is that they were using Integrated
Security. If you are running on IIS, your IIS user needs access to the database.
If you are using Entity Frameworkwith Transactions,
Entity Framework automatically opens and closes a connection with each database call. So when using transactions, you are attempting to spread a transaction out over multiple connections. This elevates to MSDTC.
MohammadJafa...
Participant
845 Points
244 Posts
Re: System.Data.EntityException :: "The underlying provider failed on Open."
Nov 21, 2011 04:34 PM|LINK
I had this error and found a few solutions:
Looking at your connection string, it looks valid. I found this blog post, the problem here is that they were using Integrated Security. If you are running on IIS, your IIS user needs access to the database.
If you are using Entity Framework with Transactions, Entity Framework automatically opens and closes a connection with each database call. So when using transactions, you are attempting to spread a transaction out over multiple connections. This elevates to MSDTC.
(See this reference and this one for more information.)
Changing my code to the following fixed it: