Error : Keyword not supported: 'metadata'


I was trying to use Hangfire.IO in my MVC ASP.NET boilerplate application and pasted this code in Startup.cs as explained here in tutorial

 GlobalConfiguration.Configuration
               .UseSqlServerStorage("bwavenueEntities"); //getting error here

            app.UseHangfireDashboard();
            app.UseHangfireServer();

But I am getting an error in above code

Server Error in '/' Application.

Keyword not supported: 'metadata'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.ArgumentException: Keyword not supported: 'metadata'.

Source Error: 


Line 75: 
Line 76:             app.MapSignalR();
Line 77:             GlobalConfiguration.Configuration
Line 78:                .UseSqlServerStorage("bwavenueEntities");
Line 79: 

Source File: E:\bwavenue\src\bwavenue.Web\App_Start\Startup.cs    Line: 77 

Can you explain how to resolve it? and why it is throwing this error here is my connection string

    <add name="bwavenueEntities" connectionString="metadata=res://*/Model.DbModel.csdl|res://*/Model.DbModel.ssdl|res://*/Model.DbModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=Test-PC;initial catalog=bwavenue;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />

Thanks


Asked by:- manish
1
: 12936 At:- 8/18/2017 12:24:24 PM
C# ASP.NET Keyword-not-supported







3 Answers
profileImage Answered by:- vikas_jk

The error, Keyword not supported: 'metadata' is because you are not passing correct connection string, you are passing Entity framework Connection string that contains a SQL Server connection string in its provider connection string parameter. WebSecurity.InitializeDatabaseConnection expects a valid database connection string.

If you will pass connection string like this

<add name="bwavenueEntities" connectionString="data source=*****;initial catalog=*****;User ID=****;password=*****;MultipleActiveResultsets=True" providerName="System.Data.EntityClient" />

It should work after the changes

3
At:- 8/19/2017 6:02:23 AM
Thanks, I see there was issue with connection string as you have explained above 0
By : manish - at :- 8/21/2017 7:53:12 AM


profileImage Answered by:- jaiprakash

Another possible answer, If you're developing/maintaining an Azure WebApp, using a connection string saved in Azure's Application Settings.

Other than each connection string in the Application Settings is a dropdown for the connection string type - it's very easy to forget to set this to 'Custom' for Entity Framework values and leave it at the default (SQL Database) - which also causes the above error.

Or In some cases, it just works by changing provider name in connection string  from 

providerName="System.Data.SqlClient"

to 

providerName="System.Data.EntityClient"

as it is an EF connection string.

2
At:- 9/15/2017 3:54:32 PM


profileImage Answered by:- bhanu

If you are using Entity framework type connection string, then you need to skip "metadata"

if (connectionString.ToLower().StartsWith("metadata=")) 
{
    System.Data.Entity.Core.EntityClient.EntityConnectionStringBuilder efBuilder = new System.Data.Entity.Core.EntityClient.EntityConnectionStringBuilder(connectionString);

    connectionString = efBuilder.ProviderConnectionString; 
}

Hope it helps.

0
At:- 5/20/2021 2:34:19 PM






Login/Register to answer
Or
Register directly by posting answer/details

Full Name *

Email *




By posting your answer you agree on privacy policy & terms of use