Live data from Hacker News

SimpleW – Web Server Library .NET Core

github.com

71–80 of 80 posts

Re: SimpleW – Web Server Library .NET Core

#71
post #58

Earlier quoted context omitted.

You shouldn't have to change the SDK. You can create a class library ASP.NET Core Server by using a FrameworkReference [1]. I can't remember the library, but there was one that had its own `IHostedService` with its own embedded ASP.NET Core Server startup within it. If your `WebApplication` requires services, of course you're going to have to register its dependencies on its `IServiceCollection`. Though, you can use…

Wow I did not know that, I was always under the assumption that I needed to have a project using the Microsoft.NET.Sdk.Web for anything Web as its base. Thanks for the info!

It used to be much more modular back in dotnet core 2.x. It was just too complex for most people to wire up everything themselves. You needed to install a lot of nuget packages, add a lot of middlewares. In the end 95% of the projects added everything anyway, but always with some little mistakes and weird errors.

Starting with 3.0 (or 5.0?) they ditched the Startup class and just added in everything by default. Much easier for the regular web application. The modular approach is still everywhere though. You can just pick the components you need, most of them also run without DI, it's just a bit of a hassle to manage all those dependencies manually.

Re: SimpleW – Web Server Library .NET Core

#72
post #15

Earlier quoted context omitted.

In total. Just compare different web frameworks by performance, flexibility, features and so on. Whatever you compare, ASP.NET Core will probably end up in the top 20%.

It's been really great since I've been able to develop on Windows and deploy to a cheap Linux VM instead of having to deal with IIS. Game-changing for me.

The old asp.net was not only horrible in regard of deployment (iis/windows). The whole thing was a mess. It might've been innovative around 2005, but it was completely scrapped in ~2016 for a good reason.

Re: SimpleW – Web Server Library .NET Core

#73
post #72

Earlier quoted context omitted.

It's been really great since I've been able to develop on Windows and deploy to a cheap Linux VM instead of having to deal with IIS. Game-changing for me.

The old asp.net was not only horrible in regard of deployment (iis/windows). The whole thing was a mess. It might've been innovative around 2005, but it was completely scrapped in ~2016 for a good reason.

It definitely turned into a mess. You're right that post-2016 ASP is when it finally found its way.

Re: SimpleW – Web Server Library .NET Core

#74
post #49

Earlier quoted context omitted.

> A web server should never be directly exposed to the Internet That's what web servers are made for, no? Like Apache, Nginx etc. I mean, you could certainly put HAProxy in front but you'd need a good reason to do this.

This is not the case for the modern Internet. More often than not, for any serious application backend, you probably want a web application firewall (WAF) in front of it and SSL termination upstream of the web server.

And also a reverse proxy / Load balancer in front of multiple Webserver instances.

Re: SimpleW – Web Server Library .NET Core

#75
post #58

Earlier quoted context omitted.

You shouldn't have to change the SDK. You can create a class library ASP.NET Core Server by using a FrameworkReference [1]. I can't remember the library, but there was one that had its own `IHostedService` with its own embedded ASP.NET Core Server startup within it. If your `WebApplication` requires services, of course you're going to have to register its dependencies on its `IServiceCollection`. Though, you can use…

Wow I did not know that, I was always under the assumption that I needed to have a project using the Microsoft.NET.Sdk.Web for anything Web as its base. Thanks for the info!

FrameworkReference enables other cursed combinations, too. You can use WinForms/WPF in an ASP.NET project with a FrameworkReference to Microsoft.WindowsDesktop.App. Finding a use case for this is left as an exercise for the reader.

Re: SimpleW – Web Server Library .NET Core

#76
post #17
post #3

But why? ASP.NET Core is one of the best web frameworks, extremely modular and flexible. It's low level components (http server, routing) can be used as a foundation for new web frameworks.

The library's tagline says "Powerfully Simple. Blazingly Fast." So there. ::folds arms:: Joking aside, I do agree that ASP.NET Core is a behemoth. On .NET 9, I just now did `dotnet new webapi` followed by `dotnet publish --self-contained -p:PublishSingleFile=true` and the binary is 103MB. That would blow up the size of a mobile app considerably, just to listen to HTTP. There a separate use case that SimpleW won't sol…

> On .NET 9, I just now did `dotnet new webapi` followed by `dotnet publish --self-contained -p:PublishSingleFile=true` and the binary is 103MB.

I've just tried the same, but with native-aot (build to native code). On Windows it was around 10mb, including routing, JSON serialization and openapi support. Startup is nearly instant.

If you include the dotnet runtime it's much bigger, but that's expected.

Edit: built with dotnet publish -r win-x64 -c Release /p:PublishAot=true /p:PublishTrimmed=true /p:PublishSingleFile=true

Re: SimpleW – Web Server Library .NET Core

#77
post #69

Earlier quoted context omitted.

Fair enough... I'd probably stick to Minimal APIs if there were fewer than 5-10 routes in a smaller service. But, with the startup and runtime overhead of .Net, I'm inclined to prefer more monolithic approaches for most general use. Just without weighing it down with a lot of heavy handed enterprisey abstractions. Edit: Of course, Aspire definitely looks interesting for more complex needs.

AFAIK FastEndpoints uses Minimal APIs... so wouldn't the overhead be similar?

They do, and it's not so much about the overhead in terms of performance so much as the cognitive load of spreading out what would otherwise be a smaller/simpler codebase.

Re: SimpleW – Web Server Library .NET Core

#78
post #15

Earlier quoted context omitted.

In total. Just compare different web frameworks by performance, flexibility, features and so on. Whatever you compare, ASP.NET Core will probably end up in the top 20%.

crazy how people just dont want to believe it, but its really really good

Yeah it's lived experience vs perception for me. .NET developers have always, ALWAYS loved to tout how great things are but there's a reason anyone even slightly outside the MS-sphere simply chooses not to use it.

Because it's not that great, really.

The performance isn't that great in real-world scenarios (remember when they had to lie, in that "one" incident)? Even today the tests look NOTHING like actual idiomiatic .NET code.

Secondly, .NET developers tend to target a particular set of DevEx that I don't personally understand but that's not the problem, the problem is the DevEx has end-user effects; they simply just don't give a shit.

Anything past a simple B2B crud app in .NET is basically an uphill battle in real companies. It never works out, it's always more complicated than it needs to be.

But hey, no one gets fired for choosing MS. So here we are.

If you drop the religious zealotry, there's simply not a lot left.

Re: SimpleW – Web Server Library .NET Core

#79
post #15

Earlier quoted context omitted.

>ASP.NET Core is one of the best web frameworks ...based on what?

In total. Just compare different web frameworks by performance, flexibility, features and so on. Whatever you compare, ASP.NET Core will probably end up in the top 20%.

> Just compare different web frameworks by performance, flexibility, features and so on.

I have.

Re: SimpleW – Web Server Library .NET Core

#80

Earlier quoted context omitted.

crazy how people just dont want to believe it, but its really really good

People (particularly, HN) still associate it with the old .NET framework days and it being tied to Microsoft, Windows Server, etc. .NET has had a hard time shaking off that old stigma, and to be fair, by the time it was really good, a lot of places already moved on to other tech (in particular, Go) .NET missed its window to escape the enterprise and despite being great, will probably never be seen as sexy. I love it…

Nope. I see this deflection attempt all the time. Plenty well versed in both old and new .NET.
Post reply on HN