C
C#2y ago
Stroniax

✅ HTTP/3 Server Without AspNetCore

For a work-related project I'm setting up a small local http API that allows applications for IPC or sys admins for troubleshooting to check on an application's state. It only has to have read endpoints for four resources and a POST endpoint for one other. I don't want to bloat the application with the entire AspNetCore suite - and when I tried to just reference the Kestrel library I had compatibility errors, looks like it hasn't been updated to work with later versions of Microsoft.Extensions.Primitives that I'm referencing. (Kestrel also leans heavily on the built-in DI which I don't want to use.) I started going the route of HttpListener, which is missing only a few features I'd like such as a RequestAborted cancellation token when a request is received, and some poor async APIs (e.g. no CancellationToken parameter). However, I was reading recently about HTTP/3 and would like to support that (don't need to worry about prior HTTP versions if I can support HTTP/3). I don't know how I can do that from HttpListener. Is there another well-tested, modern way to host an HTTP API as part of an application, particularly one that supports HTTP/3?
7 Replies
Angius
Angius2y ago
Why tho? ASP.NET Core is the web framework for .NET Not using it would be just willingly gimping yourself, reinventing all four wheels, all for zero gain
Stroniax
Stroniax2y ago
AspNetCore seems like a bloated, convoluted mess with a million dependencies when I just want to read/write to a sqlite database individually on ten thousand computers. Hmm, looking further it seems there is very little built up for HTTP/3 so I'll probably wait on that one. Still would be curious to know of other established lightweight HTTP server libraries.
Angius
Angius2y ago
Just use Minimal APIs ¯\_(ツ)_/¯ I don't get the "oh no, complex problem has a complex solution" thing tbh
Stroniax
Stroniax2y ago
That... doesn't require any less dependencies?
Angius
Angius2y ago
Well, have fun reinventing the wheel then, ig
Stroniax
Stroniax2y ago
Thanks, I was looking for something like NetCoreServer I think, I'll dig into it a little more.