Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Azure by (45.3k points)

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 on our behalf. The generated code looks like this:

public partial class MyContext : DbContext

{

    public MyContext(string connectionName)

        : base("name=" + connectionName)

    {

    }

}

We set the connection string in a local web.config also in a standard way:

<configuration>

  <connectionStrings>

    <add name="DefaultConnection" 

         connectionString="metadata=...;provider connection string=&quot;...&quot;" 

         providerName="System.Data.EntityClient" />

When we publish the app to Azure we navigate to the Azure Portal, then to the Web App's Settings, then to the list of Connection Strings. There we add the EF connection string that we had used locally. When we restart and visit the app we get a run-time error depending on the type of connection string we choose.

For a Custom type we get the following run-time error:

Keyword not supported: 'data source'.

For SQL Server or SQL Database we get the following run-time error:

Keyword not supported: 'metadata'.

This really seems like a straightforward story so we are wondering what is going wrong.

asp.net entity-framework azure azure-sql-database azure-web-sites

1 Answer

0 votes
by (16.8k points)

Seems like it is an escaped quotes problem: &quot;

Try this:

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

Browse Categories

...