C# – Entity Framework Cannot Open Database Requested By the Login – The Login Failed For User

asp.net-mvccentity-frameworknetsql server

I've just uploaded my website to a server and getting an error called "cannot open database requested by the login the login failed login failed for user".

In my global.asax file on Application_Start method, I have this :

Database.SetInitializer<MyContext>(null);

So I created my database manually and after used script to create tables. But when I want to login, it gives me an error.

On my database my tables, username and password for login page seem fine. Just can't connect to the database.

My connectionstring is:

 <add name="MyDatabase" connectionString="Data Source=serveradress;Initial Catalog=MyDatabase;User ID=username;Password=password;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" />

I'll be grateful for advice.

Best Answer

I've just solved the problem. The problem is "typical programmers problem". I needed to write MyDatabase but I wrote MyDatabse. I'm trying to solve this problem since at 11 o'clock. Thank you for your all replies.