0

Without changing any code I am getting wierd errors after updating visual studio 2015. Basically its saying:

        An exception of type 'System.Data.Entity.Core.EntityException'                                                      
        occurred in EntityFramework.SqlServer.dll but was not handled in user code

        Additional information: The underlying provider failed on Open.
        Unhandled Exception Error - Login Failed for User

When trying to access the DataBase. I am using SQL server 2014, and have changed no code in solution and changed nothing in SQL Server MS, it must be related to the latest update for visual studio released around 15/12/15. I can access the database from SQL Server ok, and can see all setting etc. But as i said I have changed nothing at all, just updated visual studio.

Has anyone else encountered this error in last few days? It is very strange, and seems unusual as im only trying to access local DB .\SQLEXPRESS

This is method where error occurs:

    private static string GetSchemaVersion()
    {
        var dataRepository = new GenericRepository();
        return dataRepository.GetAll<SchemaVersion>().Max(s => s.CurrentVersion).ToString();
    }
Sam Ra
  • 255
  • 6
  • 18
  • 1
    Do you get the same error if you use Visual Studio 2013? I usually have at least 2 versions of VS installed in case something goes haywire in one. – user8128167 Dec 16 '15 at 17:14
  • I recently encountered something similar, I had to clean my solution. It had an issue with the Entity Framework .dll. Once I cleaned, it went a way. – Greg Dec 16 '15 at 17:17
  • It would be helpful to see your exactly connection string (you can of course obfuscate the username/password). – Chris Pratt Dec 16 '15 at 17:52
  • Refer to http://stackoverflow.com/a/29390433/654031. The instance name for LocalDB in VS2015 seems to have changed. You need to make sure your database exists in the right instance. In your testing, you were most likely connecting to the old VS2013 instance. – Chris Pratt Dec 16 '15 at 17:58
  • I have same error with Visual Studio 2013, and seems like a sql thing as it was working fine with visual studio 2015 before update – Sam Ra Dec 17 '15 at 08:31

1 Answers1

0

Ok so I feel pretty stupid.. Error solved, The problem was the authentication mode changed to SQL only, it should be windows and sql authentication. It must have changed during an update. I changed that, restarted server restarted visual studio, rebuilt/cleaned project and everthing worked fine.

Sam Ra
  • 255
  • 6
  • 18