【问题标题】:Mono kestrel duplicate environment variableMono kestrel 重复环境变量
【发布时间】:2015-03-07 22:45:06
【问题描述】:

运行 k kestrel 时出现以下错误:

System.ArgumentException: An element with the same key already exists in the dictionary.
  at System.Collections.Generic.Dictionary`2[TKey,TValue].Add (System.Collections.Generic.TKey key, System.Collections.Generic.TValue value) [0x00000] in <filename unknown>:0 
  at System.Linq.Enumerable.ToDictionary[DictionaryEntry,String,String] (IEnumerable`1 source, System.Func`2 keySelector, System.Func`2 elementSelector, IEqualityComparer`1 comparer) [0x00000] in <filename unknown>:0 
  at Microsoft.Framework.ConfigurationModel.EnvironmentVariablesConfigurationSource.Load (IDictionary envVariables) [0x00000] in <filename unknown>:0 
  at Microsoft.Framework.ConfigurationModel.EnvironmentVariablesConfigurationSource.Load () [0x00000] in <filename unknown>:0 
  at Microsoft.Framework.ConfigurationModel.Configuration.Add (IConfigurationSource configurationSource) [0x00000] in <filename unknown>:0 
  at Microsoft.Framework.ConfigurationModel.ConfigurationExtensions.AddEnvironmentVariables (IConfigurationSourceContainer configuration) [0x00000] in <filename unknown>:0 
  at Microsoft.AspNet.Hosting.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 

它指向一个重复的环境变量,但我似乎无法找到它。

有谁知道重复的可能是什么?它可能与Linux有关,因为我必须重新安装它...

【问题讨论】:

    标签: c# ubuntu mono asp.net-core


    【解决方案1】:

    要解决此问题,请在开始保存并取消设置重复变量之前。在这种情况下:

    SAVE_TMP_VAR=$runlevel
    unset runlevel
    
    #run your programm
    
    export runlevel=$SAVE_TMP_VAR
    

    在你的程序完成后恢复变量。

    这里是script (init.d) which fix this issue and run kestrel

    【讨论】:

      【解决方案2】:

      这是重复的 RUNLEVEL 键

      【讨论】:

      • 你能分享解决方法吗?
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-19
      • 2021-09-17
      • 1970-01-01
      • 1970-01-01
      • 2012-09-02
      • 2018-08-05
      相关资源
      最近更新 更多