C# 单红隼重复环境变量
我运行k kestrel时出现以下错误:C# 单红隼重复环境变量,c#,ubuntu,mono,asp.net-core,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)
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有关,因为我必须重新安装…在开始保存和取消设置复制变量之前,复制了运行级密钥来修复此问题。在这种情况下:
SAVE_TMP_VAR=$runlevel
unset runlevel
#run your programm
export runlevel=$SAVE_TMP_VAR
程序完成后,还原变量
这是您可以分享解决方案吗?