karry
karry

Reputation: 13

encrypt database connect string for azure website

seems there is no good way to encrypt database connect string for azure website (not cloud service), i already view the solution here but, i can't store the database first entity framework connect string in the azure website setting, which will get below error, anyone knows how to make data base connect string secure in azure website using database first entity framework?

System.Data.Entity.Infrastructure.UnintentionalCodeFirstException: 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

Upvotes: 0

Views: 1094

Answers (1)

alltej
alltej

Reputation: 7285

You don't have to include the connection string in the web.config for your site. You can manage the connection string in your azure account at:

App Services>[your_app_name]>Settings>Application settings

Under Connection strings section, you can set the key/value pair which is the connection name and the db connection string.

After you set those values, in the screen, the connection string will be hidden for display.

Upvotes: 2

Related Questions