49 questions
3
votes
1
answer
106
views
IConfiguration Bind doesn't work with arrays
I have to set a string array in the configuration when starting an ASP.NET Core web application. I get the string array from Azure Key Vault, and it works fine. It's only included in the code below ...
0
votes
1
answer
2k
views
How to add custom configuration provider to azure functions
I implemented custom configuration provider and it works fine in a web app. But I also need to use it inside azure functions. And it seems like it's impossible at the moment. IFunctionsHostBuilder ...
0
votes
1
answer
556
views
Net Core application not reading ASPNETCORE_ENVIRONMENT value?
I deployed an ASP.NET Core 7 application to Linux Web Application in Azure.
When I access the URL I get an Application Error and the Logs shows:
System.IO.FileNotFoundException:
The configuration ...
3
votes
2
answers
1k
views
How to update IOptions / configuration in ASP.NET Core integration tests?
I have an ASP.NET Core web application and writing integration test to run the server in-memory using WebApplicationFactory (ie. https://learn.microsoft.com/en-us/aspnet/core/test/integration-tests)
...
1
vote
2
answers
4k
views
Use appsettings.custom.json to overwrite appsettings.json
I have an ASP.NET Core API that reads in config from a appsettings.json file. This is ran as a Windows service and can be installed/uninstalled. This means that updating will overwrite the appsettings....
0
votes
0
answers
210
views
Opt-in registration of Razor Class Library
To use a Razor Class Library in a client project, one adds a <ProjectReference>. That references the library's pages and static assets, and automatically registers them - I don't need to ...
0
votes
0
answers
123
views
How to get a config value from appsettings.json early in Program class?
I need to read a configuration value early in the CreateHostBuilder(string[] args) method as shown in code below. But my problem is, I couldn't figure out how to get to the Configuration object in ...
-3
votes
1
answer
269
views
How to implement a setup page in ASP.NET Core? [closed]
I want to create something like an installation page for a web application. For example, a page where the user can choose which database to use (Microsoft SQL Server, Postgres, etc.) in order to ...
6
votes
1
answer
8k
views
Serilog does not take console config from json
I have the following in my asp.net core (5) application:
var config = new ConfigurationBuilder()
.AddJsonFile("appsettings.json")
.Build();
Log.Logger = new LoggerConfiguration()
...
2
votes
2
answers
1k
views
Seeding Data - Owned Type without Id
I have an Entity describing an organization, including its postal address. The Address is stored in a property (PostalAddress) and all properties of Organization is stored and flattened in the same ...
0
votes
1
answer
119
views
What is the best approach for user defined configuration data under ASP.net CORE?
We are just getting started to convert our ASP.Net based application to .Net CORE. One decision we need to make now is what configuration file format we should use. In our current ASP.Net based app, ...
4
votes
2
answers
7k
views
How to access configuration provider values in asp.net core startup
In my asp.net core 3.1 project I have setup a custom sql provider which is working great. In my Startup I want to load only the values from the SQLConfigurationProvider into a separate dictionary for ...
0
votes
2
answers
2k
views
ASP.NET Core sessions timeout after 10 seconds
My website sessions timeout every ten seconds in the hosting environment, but works fine in my local development environment. I have been unable to change the timeout.
services.AddSession(options =&...
8
votes
3
answers
11k
views
ASP.NET Core appsettings.json not loading the correct settings
In my Azure I have ENVIRONMENT = Development, but my settings don't load.
public static IConfiguration Configuration { get; } = new ConfigurationBuilder()
.SetBasePath(Directory....
0
votes
1
answer
1k
views
.net core switching appsettings configuration based on domain
How do I get the current domain in the Startup.cs ConfigureServices? Basically I need to change some settings depending on the domain. All settings are stored in appsettings.json
appsettings.json
{
...
3
votes
2
answers
3k
views
ASP.NET Core Options pattern with name split by single underscore
I am trying to load my app settings with ASP.NET Core Options pattern.
The appsettings.json contains:
{
"TEst": "hello",
"TEST_ABC": "2"
}
POCO class:
public class AppSetting
{
public ...
1
vote
1
answer
5k
views
How to get the child elements by specifying the child name in json settings file?
"AppSettings":
{"AzureAd":
{
"Instance": "https://login.microsoftonline.com/",
"Domain": "abc.com",
"TenantId": "90836560-70ab-4caa-9e10-7e80b43d8d5a"
}
}
How to get the value of a "Instance" value ...
3
votes
1
answer
1k
views
Can I setup multiple Development environments with different appsettings.xxx.json files and debug profiles?
I've read a bit of documentation regarding setting up environments for deployment of ASP.Net Core applications. These articles usually reference Development. Staging and Production by name, but never ...
17
votes
2
answers
5k
views
why IOptions is getting resolved even if not registered
In my .NET Core project, I have below settings in Configure method:
public void ConfigureServices(IServiceCollection services)
{
services
.AddMvc()
.SetCompatibilityVersion(...
0
votes
1
answer
1k
views
Two connection strings for local and hosting server
I would like to ask if there is a way to tell ASP.NET Core 2 to choose different connection strings.
It is quite annoying to keep changing the connection string in the appsettings.json file every ...
39
votes
1
answer
48k
views
How exactly does Microsoft.Extensions.Configuration dependent on ASP.NET Core?
Does ASP.NET Core implement IConfiguration access to config values?
Most likely my question arose because I don't understand what exactly ASP.NET Core is. Well, I know it's a web framework, Not sure, ...
5
votes
1
answer
6k
views
Configuration.GetSection returns null value
I cannot get my Configuration.GetSection to return data in .Value. I think I implemented all the suggestions from this question, but still can't get it to work.
appsettings.json
{
"...
1
vote
2
answers
3k
views
Getting ConnectionStrings config settings from appsettings.json
In my repository class, I have my Config object and looks like my connection string is under:
Config > Providers > Microsoft.Configuration.Json.JsonConfigurationProvider > Data > ...
0
votes
1
answer
886
views
Configure the "prod" and "dev" of an ASP.NET Core application
I try to set up the "dev" and "prod" environments for my ASP.NET Core 2.0 application, but it does not work... Here is my config:
The appsettings.json content (exactly the same as appsettings....
43
votes
5
answers
39k
views
Getting IConfiguration from ServiceCollection
I´m writing my own extension method for ServiceCollection to registered the types of my module and I need to access the IConfiguration instance from the collection to register my Options.
Extension ...