How to set up an entity framework (first model) on microsoft azure?

I used EntityFramwok (First code) in my application, but for some reason I need to change the entity procedure for the First database. I successfully set up the project on the local computer, published the code on the microsoft azure server and tried to enter my application, it throws an exception: " 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" I searched about it on google, but did not find any clue, it seems that I am the only person who has this is an exception :( Does anyone know about this. I am new to azure, so I don’t know how to change the approach of entityframwork there any help or suggestions would be appreciated :)

+4
source share
2

azure , web.config. web.config .:)

+2

Azure . , , googling , . , , , .

: Azure, , Azure ADO.NET, - , Web.Release.config. , - , - , db. () Web.config Azure db. , , , .

, . , :

Web.config (, ):

    <configuration>
    ...
      <connectionStrings>
    <add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;AttachDbFilename=|DataDirectory|\aspnet-WebRole1-20150218073037.mdf;Initial Catalog=aspnet-WebRole1-20150218073037;Integrated Security=True" providerName="System.Data.SqlClient" />
    <add name="DbFirstModelEntities" connectionString="metadata=res://*/Models.DbFirstModel.csdl|res://*/Models.DbFirstModel.ssdl|res://*/Models.DbFirstModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=(localdb)\ProjectsV12;initial catalog=DbFirstData;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>
...
    </configuration>

, dbfirst connection db. !

Web.Release.config( DB, - , ):

<connectionStrings>
  <add name="DbFirstModelEntities"
       connectionString="metadata=res://*/Models.DbFirstModel.csdl|res://*/Models.DbFirstModel.ssdl|res://*/Models.DbFirstModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Server=tcp:<yourdatabesserver>.database.windows.net,1433;Database=DbFirstData;User ID=<user>;Password=<password>;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;MultipleActiveResultSets=True;App=EntityFramework&quot;"
       providerName="System.Data.EntityClient"
       xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>

, : , !

+3

All Articles