3

我在我的 Linux VM (Centos 7) 中从源代码安装了 mono 3.10.0

ASP.NET我已经使用主页上提供的链接安装了 KVMGithub

curl -sSL https://raw.githubusercontent.com/aspnet/Home/master/kvminstall.sh | sh && source ~/.kre/kvm/kvm.sh  

并且kpm restore正在工作文件并恢复所有包

但我无法 在Asp.Net Home Githubk kestrelHelloMvc示例中运行 我给出了错误

System.NullReferenceException: Object reference not set to an instance of an object
  at Microsoft.AspNet.Server.Kestrel.Networking.Libuv.loop_size () [0x00000] in <filename unknown>:0 
  at Microsoft.AspNet.Server.Kestrel.Networking.UvLoopHandle.Init (Microsoft.AspNet.Server.Kestrel.Networking.Libuv uv) [0x00000] in <filename unknown>:0 
  at Microsoft.AspNet.Server.Kestrel.KestrelThread.ThreadStart (System.Object parameter) [0x00000] in <filename unknown>:0 

我也试过libuv从源头安装仍然没有运气

编辑

libuv 安装遵循的步骤

wget http://dist.libuv.org/dist/v1.0.0-rc1/libuv-v1.0.0-rc2.tar.gz
tar -xvf libuv-v1.0.0-rc2.tar.gz
cd libuv-v1.0.0-rc2/
./gyp_uv.py -f make -Duv_library=shared_library
make -C out
sudo cp out/Debug/lib.target/libuv.so /usr/lib/libuv.so.1.0.0-rc2
sudo ln -s libuv.so.1.0.0-rc2 /usr/lib/libuv.so.1

Libuv再次安装后出现异常

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 
4

3 回答 3

2

看看http://carolynvanslyck.com/blog/2014/09/dotnet-vnext-impressions/关于 Kestrel 的部分。

wget http://dist.libuv.org/dist/v1.0.0-rc2/libuv-v1.0.0-rc2.tar.gz
tar -xvf libuv-v1.0.0-rc2.tar.gz
cd libuv-v1.0.0-rc2/
./gyp_uv.py -f make -Duv_library=shared_library
make -C out
sudo cp out/Debug/lib.target/libuv.so /usr/lib/libuv.so.1.0.0-rc2
sudo ln -s libuv.so.1.0.0-rc2 /usr/lib/libuv.so.1

这对我有用

于 2014-12-27T21:07:21.863 回答
2

看看http://olivierlefebvre.tumblr.com/post/101523386694/asp-vnext-alpa4-on-ubuntu

我就这样修好了。

使用的步骤

git clone https://github.com/joyent/libuv.git
cd libuv
sh autogen.sh
./configure
make
make check
sudo make install

最后通过向 lib 添加符号链接

ln /usr/local/lib/libuv.so -sf ~/.kpm/packages/Microsoft.AspNet.Server.Kestrel/1.0.0-alpha4/native/darwin/universal/libuv.dylib 
于 2014-12-28T23:43:59.970 回答
1

您遇到了一个异常,因为您有两个名称相同但大小写不同的变量。开始前转储所有环境变量:

printenv > env.dump

找到重复的变量并在开始之前取消设置其中一个(在之前保存原始值以在之后恢复它)

这是带有示例的脚本 init.d

只需保存并取消设置变量:

TMP_SAVE_runlevel_VAR=$runlevel
unset runlevel

并恢复它:

export runlevel=$TMP_SAVE_runlevel_VAR
于 2015-06-12T22:06:16.690 回答