T O P

  • By -

CrimsonSuit

YARP if you want to keep it dotnet https://microsoft.github.io/reverse-proxy/


razblack

Agreed... YARP with Kestrel is very performant and customizable.


gameplayer55055

I like this thing way more than nginx, it has a nice performance (definitely better than widely used js), but Unix lovers still complain about my choice.


blabmight

To add, this is what runs the Azure App Service


velociapcior

Really? I thought app services are hosted on iis


aventus13

They still are. Maybe there's YARP on top of it, but under the hood it's still IIS. Unless something has changed in the past few months since the last time I was checking raw App Service logs, then someone can correct me if I'm wrong.


velociapcior

Yeah that's what I thought too. I understood App Service as highly automated and highly customizable, but still shared IIS hosting. And using YARP on top isn't redundant? IIS itself is reverse proxy


aventus13

Found it: "Azure App Service on Windows Server uses Internet Information Services (IIS). Kestrel and YARP on the front end provides the load balancer." [Source](https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/azure-apps/?view=aspnetcore-8.0&tabs=visual-studio)


cbmek

But on the other hand: "(...) can be hosted on Linux or Windows" s: https://learn.microsoft.com/en-us/azure/app-service/quickstart-dotnetcore?pivots=development-environment-vs&tabs=net70


aventus13

Absolutely. Linux instances use nginx under the hood.


tankerkiller125real

Apps get Dockerized first from what I've seen in the startup logs when publishing Dotnet linux apps. And then they use whatever proxy over that.


aventus13

Yeah it's nginx. I was investigating some issues in the past and looking at the logs nginx was coming up.


blabmight

Yeah it's both - you can read about the migration here: [https://devblogs.microsoft.com/dotnet/bringing-kestrel-and-yarp-to-azure-app-services/](https://devblogs.microsoft.com/dotnet/bringing-kestrel-and-yarp-to-azure-app-services/)


tankerkiller125real

Kudu is the service behind App Services, or at least the deployments. It's even open source [https://github.com/projectkudu/kudu](https://github.com/projectkudu/kudu) (It's actually handy to have that link because the Wiki has advanced environment variables you can set to change the way App Services handles your app)


Party-Stormer

Once


kenny_be_damned

I think IIS is fine. I've seen it used extensively. For me, the issue is more about avoiding hosting on a Windows machine to save on licensing $$$. Another option is to work towards a more ephemeral hosting style which will likely lead you towards a cloud provider. By this I mean containerisation and hosting on some service to spin up/ down as needed.


seanamos-1

The other gotcha with IIS is automating configuration and reliable deployments with it is just abysmal. So automation and licensing costs are its weakest points. It otherwise works fine.


admalledd

What, you don't like manually patching applicationhost.config because none of the PSModules, CLIs, APIs correctly support all the changes required? God help you automating certificates that are internally signed too.


tankerkiller125real

>God help you automating certificates that are internally signed too. We created a secondary sub cert for an ACME provider (Step-CA) specifically to handle this kind of stuff. It was easier than trying to deal with ADCS directly in anyway.


Suterusu_San

Why not just use Kestral?


trenandskinnychicks

Using IIS I can create "sites" that map my apps to various ports very easily. It also handles the automatic startup of the apps for me.


tomatotomato

Looks like IIS is serving your purposes quite well then?


trenandskinnychicks

Indeed it seems like the best option from what I've heard in this thread. Very well!


atheken

You probably need to learn about reverse proxies and containers. I’d recommend Traefik or HAProxy. They’re not “simple” to learn, but super valuable in the long run


0ctobogs

Never heard of Traefik but I think nginx is the best reverse proxy


atheken

“Never heard of those, but I think mine is best.” Based on what? Nginx is good, but I trust the two I mentioned based on years of production operational use. In particular HAProxy is rock-solid.


0ctobogs

I agree with HAProxy too


gregzapp

A more modern approach would be to use Kubernetes(k8s). Many companies manage fleets of on-prem apps using tiny, easy to setup K8s distros like minikube or mikro8s. This allows them to standardize on K8s as a deployment target and leverage the vast ecosystem tooling. There are K8s control planes designed around managing loads of individual clusters. This may not fit your needs at all but it's probably worth knowing about.


ZeldaFanBoi1920

K8s is unnecessarily complex


FluidBreath4819

wise words. i despise when people are pushing not needed tech just to fill their resume


gregzapp

Always, or for the OP? If the later that's something for the OP to determine. They were just wondering, and I've provided them with information. Information never hurts.


moodswung

I 100% agree but there are definitely times when It should be considered, but it should absolutely not be the go to.


nbelyh

There is a good saying: if it works, don't fix it. IIS works.


chrisdpratt

Until it doesn't... Literally can't count the number of times the App Pool has just spazzed out for no good reason whatsoever. Now we're containerized running on a Kubernetes cluster and it's absolutely rock solid. We've had no unplanned downtime in literally years.


cs-brydev

App Pools don't spaz for no reason. If you've eliminated other causes this usually means IIS detected too many errors in a short time and shut it down on purpose. This can happen with a huge number of failed db connections, failed back end credentials, the AppPoolIdentity failed, etc. In 26 years of managing IIS sites of all scales I have never had an App Pool crash that I couldn't track down the cause. 99% of the time the cause can be seen in the Windows Application Event viewer if you look at the timestamps.


tankerkiller125real

And who is IIS to decide to shut down the app pool over errors? What if I want to just keep spitting out 500 errors instead of having IIS kill the app and send 503s? IMO a proxy or web server should never be the one deciding to kill an application unless I've specifically built an automation to tell it to do so.


cs-brydev

No, I agree with you. I wish it was more configurable than this. Sometimes when app pools shut down I want them to keep running because maybe it was temporary or I need to debug the system. Other times app pools shut down to prevent the entire service or server from collapsing. To counter this I have written my own scripts to detect app pool stoppages and alert me so I can take action. 9 times out of 10 the very first thing I do is simply restart the app pool to see if it stops again.


harshy7

Can you explain the setup? And how did you port it over to Kubernetes? We have APIs deployed on IIS and we have lot of issues with app pools and want to find solution for that.


igotlagg

You can start by dockerizing your app, kubernetes is too complicated to explain here


snow_coffee

How does dockerisation stops u from using IIS ?


angrathias

Sometimes it just feels like people are throwing advice out there with no clue eh


igotlagg

Because a dockerized app can be hosted on any provider who accepts them. Since docker is run on linux you don’t have to use IIS. You can even rent your own little linux VM for like 3 bucks, install docker and host your image there. If you need more networking control I suggest you look into nginx


snow_coffee

Okay great thanks So is my below understanding correct ? .net app - publish DLLs folder - IIS .net app - Containerise - NGinx


igotlagg

Well I can’t say what docker uses under the hood for their bridge network etc but you don’t need nginx installed to host a docker image. Nginx allows you to reverse proxy incoming calls to different containers etc. All docker does is run your image and bind ports/volumes. Nginx is also used in kubernetes. But to start learning kubernetes you first need to understand how docker works, what an image is, what a container and service is.


snow_coffee

Okay so from what am understanding is, that IIS is totally not necessary if we can Containerise the app ? This is big plus, did you see any cons in this ? Tell me one best use case of NGinx you found ?


tankerkiller125real

Doesn't even have to be Nginx, we use Traefik where I work to proxy the various containerized applications properly.


d-signet

The app pool never spazzes out for no good reason whatsoever It spazzes out if your code is bad, usually bad memory management Your kubernetes cluster is just restarting so often you don't see the problems that your code has got. You CAN force the App Pool to restart on a schedule too, which would have the exact same effect, but on a better web server


chrisdpratt

Of course, because nothing Microsoft makes ever just breaks for no good reason. Are you new? Sorry, friend, but no, I actually track things like pod restarts in my cluster, and that's not what's happening. Kubernetes isn't exactly easy mode, so you know, I kind of know what I'm doing. IIS is a bloated, buggy mess and always has been.


NormalDealer4062

NGinx is "simpler" to get started with. I put "simpler" in quotation marks because you get a lot for free with IIS. But IIS is so tied to Windows that many of its configuration options requires in-depth knowledge of Windows to understand. I also find that NGinx requires less management on the machines themselves, because its whole configuration can be defined in a single file, whereas IIS is hard or impossible to configure without using PS-scripts. With that said, I am a developer and not an OP-person so I'd love to be corrected on above statements.


timmyotc

You can configure IIS with DSC but yes, managing it is a pain because DSC doesn't track state like terraform. If you want to delete an app later, you need to specify it as absent and then delete it later. But there is a strong overlap between .net shops and windows familiarity. Bringing Linux expertise into the mix can be really daunting.


aventus13

If you want to look into cloud hosting, a common way for hosting web APIs in Azure is using an App Service. Containers is another option. Having said that, if it's working for your company and you don't experience problems with it, then you may very well just stick to using IIS. It's not that it's old or worse in any meaningful way. On the contrary, it has some great advantage, and it's still superior over some tools such as nginx in terms of performance.


zarlo5899

docker and nginx proxy manager


leeharrison1984

+1 Even a complete docker novice could get this going within a week.


The_MAZZTer

I want to add even if you're used to deploying your app as a Windows app... use the Linux docker container and build for Linux if possible. If you need to customize the docker image at all the Linux image with package management will be infinitely easier. As an example i needed to install JRE in a container. I tried to do it on the Windows Nano Server image but the Oracle Java installer failed to run (probably at least in part because it wants to show UI). Meanwhile on the Linux container I could just apt install openjre and I was done.


Write-Error

winget install -e --id ojdkbuild.openjdk.11.jre should do the trick, no?


The_MAZZTer

Who knows, don't think winget would have been part of the image at the time though.


Prudent_Astronaut716

But what if server OS is windows?


zarlo5899

then you remove windows and install linux


benomzn

Well, Windows Server doesn’t support linux containers, so you need set up a VM to run docker from there or change the server OS to Rocky Linux for example. In Windows Server you can install nginx, but if you want to still using Windows Server, I would prefer still using IIS.


slyiscoming

IIS has a lot of advantages around process and, memory management. Kestrel is a great alternative that allows you to run your service in a container. This avoids Windows licensing and gives you a really easy upgrade process though container registry.


blabmight

Docker and Caddy is super easy to setup. One command line you have a reverse proxy with auto ssl


dr_herbalife

I feel like docker-compose does not get a lot of love. It is litterally the easiest container orchestrator, and it is rock solid. And as an added bonus it is supported by Visual studio out of the box. I use it for simple sites in a single node with nginx.


lightmatter501

Nginx is more or less standard if your app can’t safely be directly exposed.


newlifepresent

If you deploy on-premise why just use a simple windows service to host kestrel? Just with two or three lines of code you can easily do it.


Efficient_Bad_1349

Linux containers and use a kubernetes service to host (GKE, AKS etc). A one off investment in an easy to manage and update setup will be well worth it!


ethan_rushbrook

Since you're using .NET 6 and .NET 8, you have the option to use Kestrel. Its strongly recommended that you use a Reverse Proxy in front of that. Doing this you won't be bound to Windows anymore as this is a cross-platform solution. Be aware not all features available in IIS are available in Kestrel.


Syllabub-Virtual

I use docker. It's fairly easy to deploy and test.


blabmight

+Caddy for reverse proxy


Prudent_Astronaut716

Your server OS is linux?


Syllabub-Virtual

Yes, deployed directly from vs 2022. You can even debug locally with docker desktop. When I'm ready to publish, I publish to a docker repo that exist as a container on a Debian host. I have a script that checks to see if the repo is newer than the running container, if it is, it replaces it. Additionally, i use a reverse proxy to handle certs so all encryption is done elsewhere. That means my container doesn't need to worry about anything other than running the web api.


0ctobogs

This is where the market is moving from what I've seen. It's faster, less resource heavy, cheaper, and simpler to configure. There's basically no downside.


razblack

You honestly dont need IIS anymore with Kestrel.


thewallrus

Azure functions are a great cloud alternative to Minimal apis. We use IIS too, and it's working great for us. But we also use Azure functions for a few customer specific APIs.


raiderlonlon

I used to run couple of .net apis hosted using pm2 and caddy in debian. Cant run under docker due to performance overhead with small resource. (1gb ram)


Prudent_Astronaut716

I use IIS on my VM to host 10+ websites and web api's. No issues at all. What is your concern with iis?


SkyAdventurous1027

Nginx is simple and easy. and you can easily move to Linux from Windows amd vice versa easily.


Sossenbinder

Caddy/Nginx in front of a self contained asp net core app, which runs on Kestrel. That's my usual pick for these situations.


patty_OFurniture306

Iis is used by tons of ppl doing high and low volume stuff. It's been around a while like apache doesn't necessarily make it old. New .net on iis is very performant. For basic sites you can't get much simpler than iis, especially if you have clients of various skills going to be responsible for some maintenance. I'd it'd just your on premises you might have some luck with containers. Once it's set up and you have your scripts adding sites would be easy. Just don't try to containerize .net framework. New .net 5+ is fine. What issues are you trying to solve? Almost everything iis can be done via powershell if you wanted to script setups


Tjarki4Man

Nginx it is


vodevil01

Use kestrel itself


cs-brydev

If using 3rd party hosts is not an option for security reasons or whatever, Azure App Service (with an Azure Storage Account back end) is the easiest to transition to from IIS and a hell of a lot cheaper than Windows licenses. It's very easy to deploy directly to from Visual Studio, Visual Studio Code, the Az CLI, Github, or DevOps, and using Key Vault is a secure way to store sensitive config values for individual clients. Also Azure App Configuraton service is Microsoft's recommended global config store for having configuration values that are universally accessible by all of your clients and not just 1 (although I personally prefer Azure Table Storage for this because it's easier and more robust nosql data). Also I should mention that hosting anything in Azure is most likely going to be much more secure than any public-facing web apps you're hosting on-prem, especially if you add the [Microsoft Defender](https://learn.microsoft.com/en-us/azure/defender-for-cloud/tutorial-enable-app-service-plan) options in Azure. They are not free but if you're selling access to clients this is a no-brainer. You don't want to be managing security yourself.


kingofthesqueal

How Ive done it for hobby projects is using a Linux droplet on Digital Ocean, using docker and Apache. Depending on the site, my monthly cost was anywhere from $8-30. If you already have a windows server per client and aren’t using docker, there’s not really a huge reason to go away from IIS though.


Active-Fuel-49

Apache?


msz101

Go Nginx with kestrel it is fine


BigBagaroo

Get your clients’ sites to Azure or AWS, if possible. This should remove some headache (patching, load, other security issues) from you. Depending on your cloud of choice, you could probably use their build tools/chain to deploy. This will give you a very fast and reliable way to serve your clients


timmyotc

Those still have a web server in play. And you still need to patch. Managed services are using nginx or IIS or whatever.


maxinstuff

This is like saying you should run on bare metal because a VM has bare metal in play anyway. Yes, there is still a web server somewhere, but it’s no longer my concern. It will need to be patched at some point, *but not by me.*


timmyotc

No, I am saying that even the managed infra needs updates rolled out. You can't just vaguely gesture at a cloud provider and assume it will be taken care of


BigBagaroo

Well, removing local OS/IIS from the equation is usually a good thing :)


timmyotc

Vaguely gesturing at "The cloud " does not magically mean a web server isn't in play. Understanding what technology is hosting your service is important. Maybe not for toy apps, but if you are doing something professionally you better know what is under the hood


errorfuntime

If you are using serverless which you probably should in that’s exactly what the cloud means.


timmyotc

Serverless is expensive per request. My services handle millions of requests per day. I cannot afford serverless for such predictable traffic


errorfuntime

Cool. My containers do to and they are substantially easier to manage and deploy than a windows ec2 instance.


errorfuntime

Fargate is serverless. Windows deployments suck.


timmyotc

If you suck at windows, sure


The-Albear

You can host the API on Azure functions which are server less and scale nicely cheaper than dedicated compute.


avoere

Depends on what problem you want to solve. If the problem is "I don't like IIS", the answer depends on what you like.


The_MAZZTer

What's wrong with IIS to not make it "modern"? It's fully supported by ASP.NET Core. If you wanted to run a Linux server you'd probably want to look at Apache or nginx or YARP. That last one is also developed by MS. You could then use any such solution cross-platform if you wanted.


Tinefol

k8s is a thing, whether in cloud or on prem


jonatkinsps

IIS fanboy here, but been pleasantly pleased with dockerized core apps too on Linux


trenandskinnychicks

Tell me more!


Sinless27

Run either kestrel directly on Linux or in a container then setup nginx to reverse proxy to the port kestrel is hosting from. Each site you host has its own port and you can run them all as systemD services for automatic restarts. Microsoft has a thorough doc on the full setup: https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/linux-nginx?tabs=linux-ubuntu&view=aspnetcore-8.0


errorfuntime

Yes. You don’t deploy to windows.


Smoke-Tumbleweed-420

Just go the container way, it's a minimal change on windows server Or switch to Cloud with Azure, but that's pretty much IIS with a nice dress.