Ben.Http 0.0.18

dotnet add package Ben.Http --version 0.0.18                
NuGet\Install-Package Ben.Http -Version 0.0.18                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Ben.Http" Version="0.0.18" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Ben.Http --version 0.0.18                
#r "nuget: Ben.Http, 0.0.18"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Ben.Http as a Cake Addin
#addin nuget:?package=Ben.Http&version=0.0.18

// Install Ben.Http as a Cake Tool
#tool nuget:?package=Ben.Http&version=0.0.18                

Ben.Http

NuGet version (Ben.Http)

Low level ASP.NET Core example web server

An example of using the ASP.NET Core servers for a .NET web application without any of the rest of the framework (e.g. Hosting, DI, middleware etc). So you can create your own distinct opinionated framework.

Using Ben.Http

Mostly its an example to derive from.

src\Ben.Http contains and sets up the server; it is Kestrel by default, but any server deriving from 'IServer' will also work (e.g. HttpSys, IIS, etc)

HttpServer.cs contains the server that is newed up; currently set to various defaults/

HttpContext.cs contains the Request/Response context, but this can be changed to be whatever set of properties you want to expose; in whatever way you want to expose them. Generally you get the information from the server by asking the IFeatureCollection for them and they are in the namespace Microsoft.AspNetCore.Http.Features

HttpApplication.cs is the application that deals with processing the requests. This creates and disposes of the HttpContext setting its features; and in this example Task ProcessRequestAsync(HttpContext context) is abstract so an application can derive from this class and implement that one method; and the bolierplate of setting up the Request/Response context is handled for them.

Building

dotnet build -c Release will build the project.

Of note a there is a samples/PlaintextJsonRaw project that then uses this server to create an application that implements the Techempower plaintext and json tests. This is a single file server that you can run from that directory with:

dotnet run -c Release

Also there is a samples/TechEmpowerGenerators project that then uses this server plus some extension methods to create an application that implements the Techempower plaintext, json and fortunes tests in a simpler manner than the Raw. This is again a single file server:

image

You can run from that directory with:

dotnet run -c Release

And it will set up a server listening on port 8080 and responding to the paths /plaintext, /json, /db and /fortunes. You also need to pass the postgres connection string in via connection enviorment variable:

image

Have fun!

Contributing

See CONTRIBUTING.md for information on contributing to this project.

This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior in our community. For more information, see the .NET Foundation Code of Conduct.

License

This project is licensed with the MIT license.

.NET Foundation

New Repo is a .NET Foundation project.

You should take a look at these related projects:

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net5.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.0.18 534 4/23/2021
0.0.17 1,864 2/17/2021
0.0.16 367 2/17/2021
0.0.12 520 12/28/2020
0.0.11 375 12/28/2020
0.0.10 395 12/28/2020
0.0.9 413 12/28/2020
0.0.8 353 12/27/2020
0.0.7 353 12/27/2020
0.0.6 417 12/25/2020
0.0.2 506 12/24/2020
0.0.1 384 12/24/2020