WebServerLight 0.0.23-beta-23

This is a prerelease version of WebServerLight.
There is a newer version of this package available.
See the version list below for details.
dotnet add package WebServerLight --version 0.0.23-beta-23
                    
NuGet\Install-Package WebServerLight -Version 0.0.23-beta-23
                    
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="WebServerLight" Version="0.0.23-beta-23" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="WebServerLight" Version="0.0.23-beta-23" />
                    
Directory.Packages.props
<PackageReference Include="WebServerLight" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add WebServerLight --version 0.0.23-beta-23
                    
#r "nuget: WebServerLight, 0.0.23-beta-23"
                    
#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.
#:package WebServerLight@0.0.23-beta-23
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=WebServerLight&version=0.0.23-beta-23&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=WebServerLight&version=0.0.23-beta-23&prerelease
                    
Install as a Cake Tool

WebServerLight

A C# light weight web server

Setup

In a C# Console program, you have to add this package to your project:

<ItemGroup>
    <PackageReference Include="WebServerLight" Version="0.0.23-beta-23" />
</ItemGroup>

Now you can set up your web server with the builder pattern:

var server =
    WebServer
        .New()
        ...
        .Build();

server.Start();
ReadLine();
server.Stop();

Configuration

The Web Server can be configured with the help of many configuration functions

Enabling HTTP and/or HTTPS

Insecure HTTP can be enabled like this:

var server =
    WebServer
        .New()
        .Http()
        .Build();

or specifying another HTTP port:

WebServer
    .New()
    .Http(8080)

Secure HTTPS can be enabled like this:

var server =
    WebServer
        .New()
        .Https(4433)
        .Build();

Certificate for HTTPS

There are two ways for providing a HTTPS Certificate:

  1. Configuring a .pfx file containig the certificate
  2. Automatically requesting a certificate via Let's Encrypt

If you have a valid pfx certificate with private key inxcluded, you can configure the web server to use this certificate:

var server =
    WebServer
        .New()
        .Https(4433)
        .HttpsCertificate("<path to .pfx file>")
        .Build();

To request a certificate via Let's Encrypt you can use the nuget tool https://www.nuget.org/packages/LetsencryptCert .When correctly configured (see README of this tool), it will automatically request a new valid certificate before the old certificate will be invalid. Let's Encrypt will call your website via HTTP to check the domain, so HTTP has to be enabled. All you have to do in your web server besides configuring LetsencryptCert:

var server =
    WebServer
        .New()
        .Http()
        .Https()
        .UseLetsEncrypt()
        .Build();
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
1.0.5 11 8/19/2025
1.0.4 59 8/3/2025
1.0.3 149 6/19/2025
1.0.2 147 6/18/2025
1.0.1 288 6/12/2025
1.0.0 282 6/10/2025
0.0.25-beta-25 279 6/10/2025
0.0.24-beta-24 280 6/10/2025
0.0.23-beta-23 258 6/9/2025
0.0.22-beta-22 141 6/5/2025
0.0.20-beta-21 137 6/5/2025
0.0.20-beta-20 134 6/4/2025
0.0.19-beta-19 133 6/4/2025
0.0.18-beta-18 137 6/3/2025
0.0.17-beta-17 134 6/2/2025
0.0.16-beta-16 138 6/2/2025
0.0.15-beta-15 116 2/16/2025
0.0.14-beta-14 106 2/16/2025
0.0.13-beta-13 92 2/15/2025
0.0.12-beta-12 96 2/15/2025
0.0.11-beta-11 86 2/15/2025
0.0.10-beta-10 96 2/15/2025
0.0.9-beta-9 99 2/14/2025
0.0.8-beta-8 122 2/12/2025
0.0.7-beta-7 104 2/12/2025
0.0.6-beta-6 106 2/11/2025
0.0.5-beta-5 97 2/10/2025
0.0.4-beta-4 101 2/10/2025
0.0.3-beta-3 103 2/10/2025
0.0.2-beta-2 100 2/10/2025
0.0.1-beta-1 102 2/9/2025