0

Code:

using (var context = new Storage())
{
    User user = new User();
    user = context.Users.FirstOrDefault(u => u.Email.Equals(username) && u.Password.Equals(password));

    return user;
}

Exception Details

("A network-related or instance specific error occured while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50-local Database Runtime error occured. Cannot create an automatic instance. See the Windows Application event log for error details.")

Igor
  • 60,821
  • 10
  • 100
  • 175
D Sid
  • 1
  • 1
  • 3
  • 5
    Message pretty much says it all. Your connection string is not valid. Check in your start projects config file. – Mattias Åslund Jun 10 '16 at 14:09
  • If code first, look at you Storage DbContext class, the constructor should have a name string based into the base method, this name string is the connection string it expects to find inside of your web.config / app.config.. this error suggests the connection string is missing or invalid – uk2k05 Jun 10 '16 at 14:23
  • Possible duplicate of [A network-related or instance-specific error occurred while establishing a connection to SQL Server](http://stackoverflow.com/questions/1391503/a-network-related-or-instance-specific-error-occurred-while-establishing-a-conne) – mohsen Jun 10 '16 at 18:11

0 Answers0