I am creating my first application with Azure functions and trying to connect to the local SQL Server Express database. How do I provide the connection string so that I can connect to the local SQL Server Express database successfully?
When I try to run the application locally, here is the error I get:
System.ArgumentException occurred
HResult=0x80070057
Message=Keyword not supported: 'server'.
Source=StackTrace:
at System.Data.Entity.Core.EntityClient.Internal.DbConnectionOptions.ParseInternal(IDictionary
2 parsetable, String connectionString, IList
1 validKeywords)
at System.Data.Entity.Core.EntityClient.Internal.DbConnectionOptions..ctor(String connectionString, IList1 validKeywords) at System.Data.Entity.Core.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString) at System.Data.Entity.Core.EntityClient.EntityConnection..ctor(String connectionString) at System.Data.Entity.Internal.LazyInternalConnection.InitializeFromConnectionStringSetting(ConnectionStringSettings appConfigConnection) at System.Data.Entity.Internal.LazyInternalConnection.TryInitializeFromAppConfig(String name, AppConfig config) at System.Data.Entity.Internal.LazyInternalConnection.Initialize() at System.Data.Entity.Internal.LazyInternalConnection.get_ProviderName() at System.Data.Entity.Internal.LazyInternalContext.get_ProviderName() at System.Data.Entity.Internal.DefaultModelCacheKeyFactory.Create(DbContext context) at System.Data.Entity.Internal.LazyInternalContext.InitializeContext() at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) at System.Data.Entity.Internal.Linq.InternalSet
1.Initialize() at System.Data.Entity.Internal.Linq.InternalSet1.GetEnumerator() at System.Data.Entity.Infrastructure.DbQuery
1.System.Collections.Generic.IEnumerable.GetEnumerator() at System.Collections.Generic.List1..ctor(IEnumerable
1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
My local.settings.json
looks like this:
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "xxx",
"AzureWebJobsDashboard": "xxx"
},
"ConnectionStrings": {
"RecConnectionString": {
"ConnectionString": "Server=localhost\\SQLEXPRESS01;Database=myDB;Connection Timeout=30;Integrated Security=SSPI;",
"ProviderName": "System.Data.EntityClient"
}
},
"frameworks": {
"net46": {
"dependencies": {
"EntityFramework": "6.0.0",
"Newtonsoft.Json": "10.0.3"
}
}
}
}
As implied by the error message: Message=Keyword not supported: 'server'.
The error is caused by using the 'server' keyword in your connection string.
You should replace the keyword 'server' with 'Data Source'
Data Source=.\SQLEXPRESS01;Database=myDB;Connection Timeout=30;Integrated Security=SSPI;
Alternatively, you can also modify your provider name to System.Data.SqlClient
instead of updating your existing connection string.
For your reference, this issue is also similar to the previous question here at the link below:
Keyword not supported: 'server'
Hope this helps.
User contributions licensed under CC BY-SA 3.0