I’ve been learning C# with .NET Core and would like to start hosting my projects online, everything I’ve done is locally so far.
I don’t THINK I need a Windows Server host, they seem to be expensive, I think .NET runs ok on a Linux server? But when searching for a .NET hosting provider I see windows everywhere.
I’m hoping to find as low a cost option as possible. It will be mostly for hosting projects to show potential employers / clients etc.
where do you generally host your .NET projects? I’ve seen AWS / Azure / Linode recommended, but I think costs can spiral quickly?
.NET core is supported on Linux. There is some stuff that won’t work on Linux, like WPF, but it doesn’t sound like you’re using that.
If you are searching specifically for “.NET hosting” you are bound to come across a bunch of Windows results, so I wouldn’t recommend that.
Any Linux virtual server provider will work just fine, provided they support a Linux distribution that runs the .NET core runtime, (which includes all the major ones). I’d avoid AWS or Azure. Those are a good way to run up a big bill pretty quick, and their service offerings are quite complicated.
A $5 vm from the likes of Linode, Digital Ocean, Vultr, etc, will get you started just fine. Typically the costs won’t be able to “spiral out of control”–you’ll be allocated a set amount of CPU, memory, disk, and network usage.
You will have to configure the web server & .net yourself.
I am assuming from your post that you don’t have a lot of experience with Linux. You can try setting it all up from home too if you have an old PC or laptop lying around (either for practice, or to self-host long term). Download a linux distribution and give setting up a server a shot.
I think you want to host a website/an webserver: I would recommend to rent a VM server, nothing expensive, 5$ somewhere. Use Linux, any Linux is fine. If you are a beginner, try using Ubuntu since there are plenty tutorials, guides, questions and answers. You can decide if you want to host your service directly on the Maschine using a builded application (search online for .net core build and host) or using a dedicated docker container on your server. Microsoft provides good resources and boilerplates for both. I personally like the docker way cause it requires less installation and maintenance of the VM server, but if you are unfamiliar, maybe try the direct way. Therefore you will need to install some software, basically you will do what the docker container may already provides, but the application has to be builded and executed anyways. If the application is hosted, you probably want something like an nginx or apache2 server to actually host this application on port 80/443 on your Maschine, then it should be available on the IP of your server. Try searching online for a guide how to sett this up. If you want you can also buy a domain and assign some records directing to your server ip, and you will have an domain name with your service on the internet. Congratulations.
Having never built an app in .net, my first instinct would be to try to containerise it.
This would make the installation of it (mostly) platform independent, and would let you easily prove it on your development machine.https://learn.microsoft.com/en-us/dotnet/core/docker/build-container?tabs=windows
Note that docker isn’t the only way. There is also podman, and I’m sure there are others.
All of these build ontop of the Open Container Initiative, and are mostly interchangeable. It’s only once you dig deeper into docker/podman/whatever that you might start running into compatibility issues.
I don’t think I’ve ran into any issues between using docker and podman, albeit for nodejs applications.Depends if you want a managed service or not. As stated by others, any Linux vm can do it: Aws ec2, Azure, Digital ocean, etc. Cost won’t spiral because you pay a fixed fee for the vm you choose (can be like 5 dollars a month).
The options that can spiral if for some reason your app started being used a lot. But likely these will be pretty much free:
A lot of cloud platforms have some sort of managed container service. Wrap your app in a docker container and pay per 10K API calls for example.
Another option is to use a managed service that handles the runtime for you (AWS Lambda, Google cloud app engine, etc.) These options should have the option for a dotnet core runtime. They can also be really cheap if your app isn’t used much.