Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Appsettings.json Configuration #99

Closed
timmhagen opened this issue Nov 15, 2017 · 1 comment · Fixed by #123
Closed

Appsettings.json Configuration #99

timmhagen opened this issue Nov 15, 2017 · 1 comment · Fixed by #123

Comments

@timmhagen
Copy link

I am trying to configure via appsettings.json and it works if I use full connection string. However the documentation says that you can specify the name of the connection string used in connection strings settings, but it doesn't seem to work or I have something wrong.

This works...

"ConnectionStrings": {
"MYDB": "Data Source=XXX;Initial Catalog=XXXX;Integrated Security=True",
},
"Serilog": {
"MinimumLevel": {
"Default": "Verbose",
"Override": {
"Microsoft": "Warning",
"System": "Warning"
}
},
"WriteTo": [
{
"Name": "MSSqlServer",
"Args": {
"restrictedToMinimumLevel": "Verbose",
"connectionString": "Data Source=XXX;Initial Catalog=XXXX;Integrated Security=True",
"tableName": "Logs"
}
}
]
}
}

However based on my understanding, this is supposed to work...
"To use a connection string from the element of your application config file, specify its name as the value of the connection string."

"ConnectionStrings": {
"MYDB": "Data Source=XXX;Initial Catalog=XXXX;Integrated Security=True",
},
"Serilog": {
"MinimumLevel": {
"Default": "Verbose",
"Override": {
"Microsoft": "Warning",
"System": "Warning"
}
},
"WriteTo": [
{
"Name": "MSSqlServer",
"Args": {
"restrictedToMinimumLevel": "Verbose",
"connectionString": "MYDB",
"tableName": "Logs"
}
}
]
}
}

What am I not understanding or is this not supported?

@nblumhardt
Copy link
Contributor

Hi - I'd guess this might be a limitation in the Microsoft.Extensions.Configuration support; I know connection string names work for the full framework/<appSettings>, but haven't seen the equivalent tested for .NET Core etc.

@MV10 MV10 closed this as completed in #123 Jul 9, 2018
MV10 added a commit that referenced this issue Jul 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants