Home > Software engineering >  Azure SQL Database is working locally with Entity Framework but not when I published it
Azure SQL Database is working locally with Entity Framework but not when I published it

Time:11-28

I'm getting this error please help me :(

The context is being used in Code First mode with code that was generated from an EDMX file for either Database First or Model First development.  This will not work correctly. To fix this problem do not remove the line of code that throws this exception. If you wish to use Database First or Model First, then make sure that the Entity Framework connection string is included in the app.config or web.config of the start-up project. If you are creating your own DbConnection, then make sure that it is an EntityConnection and not some other type of DbConnection, and that you pass it to one of the base DbContext constructors that take a DbConnection. To learn more about Code First, Database First, and Model First see the Entity Framework documentation here: http://go.microsoft.com/fwlink/?LinkId=394715

Here's my connection string:

connectionString="metadata=res://*/dbEspesyalTea.csdl|res://*/dbEspesyalTea.ssdl|res://*/dbEspesyalTea.msl;provider=System.Data.SqlClient;provider connection string="data source=tcp:[hidden].database.windows.net,1433;initial catalog=dbET;persist security info=True;user id=[hidden];password= [hidden];MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient"

CodePudding user response:

This is an application configuration problem.

The exception is telling you that that

connectionString="metadata=res://*/dbEspesyalTea.csdl|res://*/dbEspesyalTea.ssdl|res://*/dbEspesyalTea.msl;

is not your connection string. And somehow you've configured the deployed application to use a plain SQL Server connection string and not an "entity connection string" (ie with the edmx file locations).

So double-check and then log the connection string your deployed application is using. If

  • Related