3 ms·
How do you deploy a .NET app these days?
by kbrannigan 4y ago
How do you deploy a .NET app these days?
- quickthrower2 4y agoGood question that I am asking myself! Azure seems to have some good pricing now for hobbyist for DB and app but we are talking 20/m so not cheap but it is all managed / serverless. (Edit: for a hobby it seems you can get cheap on https://azure.microsoft.com/en-ca/pricing/calculator/ https://azure.microsoft.com/en-ca/pricing/calculator/ by picking: Sql DB: East US > Single Database > vCore > General Purpose > Serverless App Sercice: East US > Linux > Free Estimated monthly cost $1.27) Otherwise you can run it on any linux box and install all the dependencies yourself, if you use .Net Core or .Net 5 or higher I think. And of course you can rent a windows VM and it should run directly on that. What I don’t see is anyone outside of Azure wanting to support .NET in a serverless way out of the box. Feels like there might be a gap for a Vercel of .NET.
- kcartlidge 4y agoObviously Azure is the intended home from the MS point of view, but AWS does have out-of-the-box support for .NET 6 Lambda functions. I appreciate that isn't the same level of ease as some other abstractions or serverless frameworks, but it is definitely a mainstream option.
- quickthrower2 4y agoThanks. I don’t have much AWS experience but that is good to know. To me it is another big cloud option. Big cloud options usually have extra steps. For example in Azure you need to configure your DB firewall to let the app have access, and so on. The more heroku level stuff would probably do this for you.
- mattmanser 4y agoYou can run .net core on Linux now btw, works great. See my comment at same level.
- kcartlidge 4y ago> How do you deploy a .NET app these days? (Note that this is an answer to this specific comment, not to the OP) The latest .NET builds binaries that work without needing a framework installed on the server. They are effectively just like any other application, so the same tooling you'd use to kick off any executable will work fine. A simple option might be to `scp` it onto a server and manage it as a systemd service. Or perhaps stick it in a container (it builds cross-platform so Linux is fine) and use a deployment pipeline. If you need extra options then you can front it with nginx etc, but it will also handle direct traffic itself (including TLS). For persistence you have the usual cloud stuff, otherwise there's great support for Postgres or even fully embedded SQLite or similar. And .NET is very performant too, so for most use cases scaling vertically is all you'll ever need (except for redundancy of course). I could go on with other options, but in brief I think that what I'm saying is when it comes to deployment these days being .NET makes it at least as easy as the alternatives, unlike the old Framework days when it was much more 'special'.
- mattmanser 4y agohttps://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/linux-nginx?view=aspnetcore-7.0 https://learn.microsoft.com/en-us/aspnet/core/host-and-deplo... Here's how to deploy it on a Linux VM. Most of the instructions are about setting up nginx (the reverse proxy). You can follow those instructions to deploy it to a cheap digital ocean droplet for example, or an AWS VM. Once it's set up it's trivial to deploy by FTP. Or you can deploy it to Azure, which is simpler and can automatically trigger a release on a git push, but more expensive if you need certain things which force you off the free tier: https://learn.microsoft.com/en-us/azure/app-service/quickstart-dotnetcore?tabs=net60&pivots=development-environment-vs https://learn.microsoft.com/en-us/azure/app-service/quicksta... You can still deploy it to IIS too, but I think the writing's on the wall for hosting via IIS so not sure if it's worth learning.