database - Azure: The context is being used in Code First mode with code that was generated from an EDMX -


i have mvc app running fine in local. after updating azure, started throwing error:

the context being used in code first mode code generated edmx file either database first or model first development. not work correctly. fix problem not remove line of code throws exception. if wish use database first or model first, make sure entity framework connection string included in app.config or web.config of start-up project.

i have checked if there difference between local web.config , azure web.config. except credentials, same. , read:

<add name="dbentities"       connectionstring="metadata=res://*/dbmodel.csdl|res://*/dbmodel.ssdl|res://*/dbmodel.msl;                        provider=system.data.sqlclient;                        provider connection string=&quot;data source=xx;initial catalog=xx;persist security info=true;user id=xx;password=xx;multipleactiveresultsets=true;application name=entityframework&quot;"       providername="system.data.entityclient" /> 

i using ef 6.1.3, mvc5

i ran same error message , managed solve of this post here on stackoverflow.

in azure management / web apps / [your web app] / configure / connection strings , make sure of 3 things :

  1. the connection string has same name connection string in project.

  2. the connection string value contains of metadata appears in connection string in project. mine looks this:

    metadata=res://\*/models.[mymodel].csdl|res://\*/models.[mymodel].ssdl|res://\*/models.[mymodel].msl;provider=system.data.sqlclient;provider connection string="server=tcp:[mydbserver].database.windows.net,1433;database=[mydb];user id=[mydbuser]@[mydbserver];password=[mypassword];trusted_connection=false;encrypt=true;connection timeout=30;"

  3. the third column (default set sql database) set custom


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -