DEV Community

Discussion on: Anything like PHP's PSR-7/15 for C# and ASP.NET Core?

Collapse
 
radumg profile image
Radu Gidei

Have a look at ASP .NET Core that now ships with Kestrel (docs.microsoft.com/en-us/aspnet/co...) as well as happy-path NancyFX : nancyfx.org/

Collapse
 
mindplay profile image
Rasmus Schultz

As others have pointed out, the main problem with ASP.NET and Kestrel, is you get an entire framework with all manner of abstractions, IOC, authentication, templating, etc. etc. - and all of it is deeply coupled.

Nancy looks nice - but again, this is a framework, not a general abstraction.

I can see Kestrel being extremely valuable for it's high performance and quality - but, much like PHP, it's all highly integrated and very opinionated; it's an all-or-nothing sort of deal.

What I long for is an implementation-independent set of abstractions for (immutable) request, response, headers, URI, body, and factory abstractions for those - and a simple middleware-interface that describes the HTTP request/response exchange, nothing more.

Upon that, we can build simple middleware hosts for Kestrel, for System.Net.HttpListener, or for anything else - a host being just something that generates requests, passes them to your middleware, and emits the response.

This approach has already worked wonders on most other platforms, including at least PHP, Node, Ruby and Dart, so it's really surprising, and somewhat disappointing, not to find something like this in the .NET world. 😐