Johnny salmon
Johnny salmon

Reputation: 1

Add app.config to .net core 3.1 web api application

i'm moving my project from .net framework to .Net core 3.1 web api. .Net doesn't seem to include app.config file and I need to add it. I added one but it's doesn't recognized. Is there a way to add app.config file to .Net core app ? or is there any alternative of app.config .net core ?

App.config:

<configSections>
        <section name="corememorycache" type="NHibernate.Caches.CoreMemoryCache.CoreMemoryCacheSectionHandler,NHibernate.Caches.CoreMemoryCache" />
        <section name="hibernate-configuration"
                 type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" />
    </configSections>

    <corememorycache expiration-scan-frequency="00:05:00">
        <cache region="foo" expiration="500" sliding="true" />
        <cache region="noExplicitExpiration" sliding="true" />
    </corememorycache>

Upvotes: 0

Views: 4068

Answers (1)

Jakub Kozera
Jakub Kozera

Reputation: 3493

In .NET Core the approach is a bit different. By default you should use appsettings.jsonfile

Here is an article about .NET Core configuration: https://learn.microsoft.com/en-us/aspnet/core/fundamentals/configuration/?view=aspnetcore-3.1

Upvotes: 1

Related Questions