I just figured I’d post this here for anyone else interested.
I was able to get part way into running .net under shared hosting.
Although to run an actual site you would probably need passenger 6 instead of passenger 5 support (I’m pretty sure passenger 5 is in use on the shared hosting at the moment).
This still might be useful for anyone using VPS or just wants to run a dotnet script as a cronjob periodically though. It works in a similar fashion to running a custom version of python3.
That being said I wouldn’t want to go against any form of TOS or rules since Microsoft technicologies aren’t officially supported by dreamhost, so any feedback would be welcome.
.Net Core Overview
.Net Core is a different animal than the original old mono / 4.7 version of .Net
It’s a lot more self contained (similar to an install of python3) and it doesn’t require that much in the way of dependencies.
It was basically a total re-write of the framework to be Linux friendly.
Currently it’s possible to get Ruby / Python / NodeJS working via Passenger, so I was curious as to if it would be possible to get .Net core working as well.
Personally I’m using a Shared Host (not a VPS) so no sudo access.
I’ve managed to get as far as running a simple hello world program from the shell under .Net Core 6 which I’ll List below
First download and extract the runtime (I’m using .Net 6 preview here)
mkdir dotnet6 cd dotnet6 wget https://download.visualstudio.microsoft.com/download/pr/898bd961-c1fe-4e22-8692-d488ee838afd/315180a646a83063ceaae7a8ab9804cf/aspnetcore-runtime-6.0.0-preview.7.21378.6-linux-x64.tar.gz tar -xvzf aspnetcore-runtime-6.0.0-preview.7.21378.6-linux-x64.tar.gz
Next you’ll need to patch the header of the dotnet exe using paxctl
It may be possible to do this on the host, although paxctl isn’t installed there so it’s probably best to do this on a separate linux box
Then copy it across / overwrite it on the host
paxctl -c -m dotnet
Without this you will probably run into the problem of seeing a
Failed to create CoreCLR, HRESULT: 0x80004005
I suspect this might be related to grsecurity on the kernel
Running a console app
Lets setup some paths, I’m not sure these are actually needed but lets set them up anyway
mkdir /home/username/tmp TMPDIR=/home/username/tmp COMPlus_EnableDiagnostics=0 DOTNET_ROOT=/home/username/dotnet6
It should now be possible to run a simple program with something like
If you build a self contained exe with the runtime inbuilt
then you’ll probably need to do the same paxctl patch on it as above
I did a quick check on the host for the needed dependencies with
/sbin/ldconfig -p | grep XXX
All of these seem installed
- libicu60 (for 18.x)
- libssl1.1 (for 18.x, 20.x)
Ones that were missing were
Used for Zips / Compression I think
libgdiplus (version 6.0.1 or later)
(used for System.Drawing.Common which isn’t likley I think on a website)