单声道红隼重复环境变量

时间:2015-03-07 22:45:07

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

运行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有关,因为我不得不重新安装......

2 个答案:

答案 0 :(得分:0)

重复的RUNLEVEL键是

答案 1 :(得分:0)

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

SAVE_TMP_VAR=$runlevel
unset runlevel

#run your programm

export runlevel=$SAVE_TMP_VAR

程序完成恢复变量后。

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