.net core can not be converted from "IConfigurationSection" as "System.Action <T>"

 Description: We first create a ConfigurationBuilder objects, and on it registered a JsonConfigurationSource. In creating this JsonConfigurationSource object, apart from the specified configuration file ( "siteconfig.json") path, we will ReloadOnChange its property is set to True. Whether this time meaning ReloadOnChange property is when the contents of the original configuration file changes need to reload the configuration.

 

  This time we will find Configure <T> (config.GetSection (key)) error:

 

 

  I've looked at before we services.Configure in Startup in <T> () found that there is inside the parameters of a two overloaded is a IConfiguration is System.Action <T>, then why not come out here to reload it?

 

   Very puzzled, and finally found a small extension class Microsoft.Extensions.Options.ConfigurationExtensions

 

  By this we add NuGet Install-Package Microsoft.Extensions.Options.ConfigurationExtensions issue is resolved,

Guess you like

Origin www.cnblogs.com/YH-D/p/11703618.html