1

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"

Bart K
  • 23
  • 4
  • 2
    It might be database related issue... it might be MVC version related issue... or many others. More info would help your case. What database are you using? How do you connect to it? What is the exact error you got? – Ian May 10 '17 at 11:05
  • This might be helpful: http://stackoverflow.com/questions/2575907/cannot-open-database-test-requested-by-the-login-the-login-failed-login-fail – Ian May 10 '17 at 11:18
  • no sorry, the issue is that I can make connection to the database, only when the connection fails I have to restart the application to have it working again. – Bart K May 10 '17 at 11:28

0 Answers0