Hi all

I am using asp.net 4.0 for my application that connects to sql server 2008 via ADO.Net Entity Framework. When there is bit increase in traffic the site goes down. I notice below error in event management

Execution of the command requires an open and available connection. The connection's current state is broken.

I am developing application with Entity Framework for the first time, and its opening and closing connection by itself. What i think is the connection to data base needs to be opened and closed manually.

If i am rite kindly tell me how can i do it but if i am not what other thing might throw this exception.


Recommended Answers

All 6 Replies

How many active connections have you got specified. I would think increasing the size of the connection pool would help.
Also, checking that the open connections are used as efficiently as possible; you want them returned to the pool the instant they are free.

I guess you are pointing at max pool size in connection string, i don't have that specified.

The server will have a default connection size. Depending on how you are hosting the site there are various ways to alter it. If you have access to a cpanel for your host you would probably be able to find it there. If you are hosting it yourself it will be in a config somewhere.

Yes i have access to the control panel but i have not change the settings because i have no knowledge of it and i fear some thing might go wrong. Can you guide me where can i find it and what settings should i change?

May be you have to create an object of Context for each unit of work.

Can you explain how can i make an object separately for each unit

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.