aspnet / KestrelHttpServer

[Archived] A cross platform web server for ASP.NET Core. Project moved to https://github.com/aspnet/AspNetCore
Apache License 2.0
2.63k stars 529 forks source link

Object reference not set to an instance of an object when k kestrel on mono 3.8.1 on CentOS 6.5 #29

Closed gzpbx closed 10 years ago

gzpbx commented 10 years ago

I check the Home project, it says kestrel should support on mono, do I need install something on CentOS first ?

/home/fxUser/.kre/packages/KRE-mono45-x86.1.0.0-alpha3/bin/klr.host.dll Information : 0 : [NuGetAssemblyLoader]: Loaded name=Microsoft.AspNet.Server.Kestrel in 0ms
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 

[fxUser@fat15-linux01 HelloMvc]$ mono -V
Mono JIT compiler version 3.8.1 (master/2332ba9a Wed Aug 27 17:35:50 CST 2014)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
    TLS:           __thread
    SIGSEGV:       altstack
    Notifications: epoll
    Architecture:  amd64
    Disabled:      none
    Misc:          softdebug 
    LLVM:          supported, not enabled.
    GC:            sgen
davidfowl commented 10 years ago

Only works on osx not on linux

Tragetaschen commented 10 years ago

Actually, it works on Linux when you replace the libuv.dylib OSX-Binary with a link to a recent libuv-11 binary. ln -sf /usr/lib/libuv.so.11 native/darwin/universal/libuv.dylib I've done so successfully with mono-3.8.1 in a Yocto qemu ARM image.

It could work if mono would distinguish between Linux and OSX. Then Kestrel could load a different native library.

DavidKarlas commented 10 years ago

Shoulnd't this be handled via http://www.mono-project.com/docs/advanced/pinvoke/dllmap/?

Nice example I found via search: https://github.com/seuffert/XBSlink/blob/master/XBSlink/SharpPcap.dll.config

carolynvs commented 9 years ago

Was this closed because Kestrel does not intend to support Linux? Or some other reason?

Just wondering if it is a reasonable expectation that one can run asp.net vnext applications on linux using Kestrel. If not, any idea what the recommendation is to use?

juzzbott commented 9 years ago

When I try and use the 'ln -sf /usr/lib/libuv.so.11 native/darwin/universal/libuv.dylib' fix, I get the following error: ln: failed to create symbolic link ‘native/darwin/universal/libuv.dylib’: No such file or directory

This is trying to run the command from the HelloMvc directory using Ubuntu 14.04 and Mono 3.8.0. Where do I need to run this command from to get to work?

suhasj commented 9 years ago

@juzzbott I found this article to be helpful. http://carolynvanslyck.com/blog/2014/09/dotnet-vnext-impressions/ Basically we need to recompile the libuv and drop it in the native/darwin/universal folder in .kpm/Kestrel package folder

ezhaka commented 9 years ago

@suhasj I tried to replace libuv.dylib in packages by libuv.dylib provided in the article, but it didn't help, still NullReferenceException. I have mono 3.10.0 installed

ezhaka commented 9 years ago

https://github.com/aspnet/KestrelHttpServer/issues/37 helped me, I had installed wrong version of libuv

nchinan commented 9 years ago

@mcgee try running ldconfig after you compile and install libuv 0.11.29 . That's what got it working for me

selimserdengecti commented 9 years ago

It works on Ubuntu 14.04 with libuv 1.x or later. Kestrel might miss some configuration/files which libuv has. As @mcgee mentioned refresh cache with ldconfig after install and hit localhost:5004.

carolynvs commented 9 years ago

I just used this blog post to rebuild and update libuv and am able to use kestrel with mono 3.10.0 on ubuntu.

stage88 commented 9 years ago

Here are the instruction to install libuv manually on Ubuntu/linux. You'll need gyp for bellow to work.

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

Thank to Carolyn: http://carolynvanslyck.com/blog/2014/09/dotnet-vnext-impressions/

Also here is my mono version:

Mono JIT compiler version 3.10.0 (tarball Wed Nov  5 13:32:50 UTC 2014)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
    TLS:           __thread
    SIGSEGV:       altstack
    Notifications: epoll
    Architecture:  x86
    Disabled:      none
    Misc:          softdebug 
    LLVM:          supported, not enabled.
    GC:            sgen

I've used yo aspnet then created an MVC site. I cd into the directory where the project.json is and do kpm restore then kpm build, then k kestrel and viola, I know have an aspnet50 MVC site on my Ubuntu. Yes painful but satisfying.