Skip to content
This repository has been archived by the owner. It is now read-only.

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 opened this issue Sep 2, 2014 · 12 comments

Comments

@gzpbx
Copy link

@gzpbx gzpbx commented Sep 2, 2014

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
Copy link
Member

@davidfowl davidfowl commented Sep 2, 2014

Only works on osx not on linux

@gzpbx gzpbx closed this Sep 2, 2014
@Tragetaschen
Copy link
Contributor

@Tragetaschen Tragetaschen commented Sep 2, 2014

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.

@carolynvs
Copy link

@carolynvs carolynvs commented Sep 12, 2014

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
Copy link

@juzzbott juzzbott commented Oct 10, 2014

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
Copy link
Contributor

@suhasj suhasj commented Oct 10, 2014

@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
Copy link

@ezhaka ezhaka commented Nov 19, 2014

@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
Copy link

@ezhaka ezhaka commented Nov 19, 2014

#37 helped me, I had installed wrong version of libuv

@nchinan
Copy link

@nchinan nchinan commented Nov 20, 2014

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

@selimserdengecti
Copy link

@selimserdengecti selimserdengecti commented Dec 7, 2014

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
Copy link

@carolynvs carolynvs commented Dec 7, 2014

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
Copy link

@stage88 stage88 commented Dec 23, 2014

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
You can’t perform that action at this time.