Setting EF Connection String in Azure Web App

后端 未结 4 1637
误落风尘
误落风尘 2020-12-30 04:10

We have an ASP .NET (MVC) app and are using Entity Framework 6 to connect to our databases. The DbContext is constructed in a standard way and it loads the connection string

4条回答
  •  灰色年华
    2020-12-30 04:18

    The problem is the escaped quotes: ".

    The connection strings in web.config have quotes escaped because they are serialized in an XML attribute. When entering a connection string in the Azure portal you should provide the raw unescaped string. Something like this:

    metadata=...;provider connection string="Data Source=..."

    David Ebbo's answer is good for confirming that the Environment is set up as you expect. It is also helpful to pay attention to the .pubxml file when publishing via the wizard in Visual Studio: it will try to populate connection strings as well.

提交回复
热议问题