Error while reading json file in dotnet core “the configured user limit (128) on the number of inotify instances has been reached”

前端 未结 3 1081
夕颜
夕颜 2020-12-17 16:25

I have an console application (in dot net core 1.1) which is scheduled in cron scheduler for every 1 min. Inside the application there is call to configuration file. I\'m a

3条回答
  •  庸人自扰
    2020-12-17 17:09

    The reason why error the configured user limit (128) on the number of inotify instances has been reached happens is right - on non Windows environment reloadOnChange cause the issue while accessing appSetting.json files.

    But there is a think you could miss while adjusting this. I addition to setting reloadOnChange to false:

    .AddJsonFile($"appsettings.json", optional: true, reloadOnChange: false);
    

    you should also make sure you are not starting from default WebHost.CreateDefaultBuilder because inside it reloadOnChange is also set to true. So the best way to control what your web host is would be to configure it from scratch without not needed options (e.g. WebHost.CreateDefaultBuilder also does .UseIISIntegration() which probably don't need at all in your environment).

    The example of custom web host - a copy of Microsoft WebHost.CreateDefaultBuilder but with IIS and FileWatcher dependencies removed e.g. for Linux environments.

提交回复
热议问题