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>();
  • 相关阅读:
    chrom插件开发
    实验7
    第六次实验报告
    c++第五次实验报告
    c++第四次实验报告
    c++第三次实验报告
    C++第二次实验
    c++第一次作业
    HttpWebRequest调用webservice
    树状组织结构-Tree
  • 原文地址:https://www.cnblogs.com/zhihang/p/14803698.html
Copyright © 2011-2022 走看看