Issue while reading appsettings properties. RRS feed

  • Question

  • I am facing one strange issue. I have a webapi project which is of .net framework 4.8. i am referencing one nuget package (named HealthCheck) which is developed from .net standard 2.0 library project and adding as a nuget package referenct to .net framework 4.8 version api project. In my api project i have appsettings.json file which is getting read and converted to my model object as below. This reading of settings file code is inside Healthcheck nuget (which is a message handler created into the healthcheck nuget library). 

     IConfigurationRoot _configuration = new ConfigurationBuilder().AddJsonFile(SettingsFileName, true, true).Build();

    There is one section which is getting converted to model object only when i use reference of StrongNamer nuget package in api project.

    If i remove the strong namer nuget reference then one of my specific properties will not bind to the model object.

    I am not sure what is the issue. The healthcheck nuget is signed one.

    Below properties are not getting converted to model object withou using strong namer nuget.

    "HealthChecks": {
        "EndpointCheck": [
            "Name": "ABC",
            "Timeout": 10000,
            "Uri": "http://xyz/apiname",
            "ExpectedHttpCodes": [ 200 ]

    I do not know what is the issue while reading  above portion without strongnamer nuget.

    Tuesday, September 15, 2020 2:21 PM

All replies

  • Hi Vimalkumar p,

    Thank you for posting here.

    For more efficient responses about this problem, you can consider posting your question in ASP.NET forums.

    Thank you for your understanding.

    Best Regards,

    Xingyu Zhao

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, September 16, 2020 2:08 AM
  • I found where is the issue.

    The healthcheck nuget which i am using has internal reference to the nuget which is not signed.

    I was using one property in model from the unsigned nuget.

    When i removed the property in model which is referenced from Unsigned assembly, it started loading the model object with the values specified in appsettings.json file.

    Wednesday, September 16, 2020 5:19 AM