I have an issue with my database connection in Entity Framework. I'm using EF 4.1.10331 in an ASP.NET MVC 3 web application but it also fails with EF 5.
When my web application starts when SQL Server for some reason is unavailable, the website throws an error which is ok.
When SQL Server is available again, the website keeps throwing this error until the pool gets recycled.
I tried upgrading from .net framework 4 to 4.5.2 but that doesn't help either.
I've been searching for a solution for hours but haven't found one.
Pleas help me out
Edit:
I'm connecting to a SQL Server database. The error that I have during the reproducing of the issue is:
Cannot open database "{dbname}" requested by the login. The login failed.
but in the production environment the catalog can be unavailable for all kinds of reasons.
In my application I connect to the database using an .edmx
file
edit2: my connection string is like this: add name="DBContext" connectionString="metadata=res:///Import.csdl|res:///Import.ssdl|res://*/Import.msl;provider=System.Data.SqlClient;provider connection string="data source=;initial catalog=;persist security info=True;user id=;password=;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient"