Entity Framework Data Reader Production Error
Only on production, I'm getting this error: "Execution of the command requires an open and available connection. The connection's current state is closed." What's weird is where its saying its happening. It's happening in a place that's never happened in all of our development, testing, or UAT sessions.... here is the underlying process.
We use the MVP pattern. This isn't as important, but here's essentially the flow:
- Presenter instantiates an associated repository and call a method to query the appropriate data, and pass it开发者_如何学运维 to the model. The query is still live against the database at this point (not iterated through or had ToList called).
- View binds this data to a drop down control. Here, when it iterates through to create the list of items, the error occurs.
We are binding around 8 drop downs at this point. Again, I've not experienced this at any other point - this isn't consistent enough either. Any ideas?
Thanks.
I suspect your connection pool is being maxed out due to the context not being disposed properly (as @Adam has stated). Increase your pool settings (or decrease timeout) to test but you need to dispose of the context properly (credit goes to @Adam).
You can test this using performance counters http://msdn.microsoft.com/en-US/library/ms254503(v=VS.80).aspx
精彩评论