mono - 无法使用 KestrelHttpServer 启动网站(错误 : Object reference not set to an instance of an object)

标签 mono asp.net-core centos7

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

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

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

kpm restore 是工作文件并恢复所有包

但我无法在来自 Asp.Net Home GithubHelloMvc 示例中运行 k kestrel
我报错

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 

最佳答案

看看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

最后通过添加符号链接(symbolic link)到库

ln /usr/local/lib/libuv.so -sf ~/.kpm/packages/Microsoft.AspNet.Server.Kestrel/1.0.0-alpha4/native/darwin/universal/libuv.dylib 

关于mono - 无法使用 KestrelHttpServer 启动网站(错误 : Object reference not set to an instance of an object),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27654589/

相关文章:

asp.net-core - 如何将 MiniProfiler 4 记录到 Serilog(或在中间件内访问)?

python-3.x - 如何在没有 root 的情况下从源代码构建 Python 3.5.2

mysql - centos7: 不允许操作 - mysql

c# - 从在 Mono 上运行的 C# 进程运行 C++ 应用程序。运行检测器错误

linux - 为什么 SerialPort.Open() 会失败?

c# - 带有 Mono 的 ubuntu 上的 Nancy selfhosting 错误

mysql - crontab 执行在 bash 脚本中导出 xlsx 文件的 mysql 查询时出错

android - MonoForAndroid : android-support-v4. jar编译问题

c# - 自定义标签助手 : How do I use complex objects in attributes?

asp.net-core - 如何在 dotnet core 中验证非对称签名的 JWT?