Base solution for your next web application
Open Closed

loading configuration from ini file fails in web #3442


User avatar
0
carelearning created

Hello,

We have a need to load configuration settings from a config.ini file (it is in the bin folder of the project) at start-up. In a winform project we have MyCompanyName.AbpZeroTemplate.WinformApp. AbpZeroTemplateProviderModule:

public override void Initialize()
        {
                   IocManager.IocContainer.Register(Component.For<ConfigurationManager>()
                                   .DependsOn(new { fileName = "restapi.ini"}));
}

This works and everything is happy.

When we try to do the same in the web project, it fails to load the file. Is there something we are forgetting to check or is there a better way to load program configuration settings which we don't want the user to see?

Thank you


3 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Alternatively, you can use ABP's setting system, see <a class="postlink" href="https://aspnetboilerplate.com/Pages/Documents/Setting-Management">https://aspnetboilerplate.com/Pages/Doc ... Management</a> You can define your settings in AppSettingProvider class.

    But if you want to use ini files, we can test your case and try to find the problem.

    Thanks.

  • User Avatar
    0
    carelearning created

    Dear @ismcagdas,

    We used the premise of your suggestion to simplify our configuration options by creating a static class and hard coding the return values. The class lives in the Application project and is used by both Abpz projects as well as our custom ones so we wanted global one-time configuration, but don't need to store in the database. We are using this conjunction with a third-party Rest client.

    This issue has been resolved.

    Thank you for your time and expertise.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Thanks @careLearning :)