zoukankan      html  css  js  c++  java
  • Net Core linux docker 部署异常

    环境:

      .NET Core 3.1

      Linux + Docker

    问题:

    近期发布后发现,服务经常需要多次重启才能启动。观察日志发现异常:

      Unhandled exception. System.IO.IOException: The configured user limit (128) on the number of inotify instances has been reached, or the per-process limit on the number of open file descriptors has been reached.

    尝试网上很多方法后,还是出现了问题,通过断点发现 Configuration 的 ReloadOnChange 不管怎么样都是 true,后面通过如下方法解决了

      

      webBuilder.ConfigureAppConfiguration((hostingContext, config) =>
                        {
                            IHostEnvironment env = hostingContext.HostingEnvironment;
    
                  //调用Clear 会报错,因时间就没有深查了 config.Sources.ForEach(source
    => { if (source is JsonConfigurationSource) { var jsonConfigurationSource = (JsonConfigurationSource)source; jsonConfigurationSource.ReloadOnChange = false; } }); config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: false) .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: false); if (env.IsDevelopment() && !string.IsNullOrEmpty(env.ApplicationName)) { var appAssembly = Assembly.Load(new AssemblyName(env.ApplicationName)); if (appAssembly != null) { config.AddUserSecrets(appAssembly, optional: true); } } config.AddEnvironmentVariables(); if (args != null) { config.AddCommandLine(args); } }).UseStartup<Startup>();
  • 相关阅读:
    2020.9.26
    2020.10.2
    判断方法
    sql与include
    File类的获取方法
    【每日日报】第十五天
    【每日日报】第十三天
    【每日日报】第十四天
    两数相加(输入框)
    判断闰年
  • 原文地址:https://www.cnblogs.com/zhihang/p/14803698.html
Copyright © 2011-2022 走看看