I took steps to publish my web application using the database first on the azure portal.
However, when I post a message, I get the following error message:
Code generated using T4 templates for the First and Model databases The first development may not work correctly if used in Code First mode. To continue using the First or Model First database, make sure that the Entity Server Connection String is specified in the application execution configuration file. To use these classes that were generated from Database or Model First, with code First add additional configurations using the attributes or the DbModelBuilder API, and then remove the code that throws this exception.
My connection string in web.config after it has been changed by the publication:
<add name="MySiteEntities" connectionString="metadata=res://*/MySite.csdl|res://*/MySite.ssdl|res://*/MySite.msl;provider=System.Data.SqlClient;provider connection string="data source=tcp:**********.database.windows.net,****;initial catalog=MySite;user id=username@ **********;password=*******;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" />
My context (generated by edmx):
public partial class MySiteEntities : DbContext { public MySiteEntities() : base("name=MySiteEntities") { } ...
I am very confused because it seems that the framework entity is trying to use the code first, not the database first.
UPDATE: I just tried using the same connection string locally, and the web application seems to be working fine. The web application really connects to the remote database. Only when I publish on the azure image does it fail.
source share