Improve this Doc View Source

Class UriHttpListenerExtensions

Async helpers for the HttpListener

Inheritance
System.Object
UriHttpListenerExtensions
Namespace:Dapplo.HttpExtensions.Listener
Assembly:Dapplo.HttpExtensions.dll
Syntax
public class UriHttpListenerExtensions

Methods

| Improve this Doc View Source

ListenAsync<T>(Uri, Func<HttpListenerContext, Task<T>>, CancellationToken)

This method starts a HttpListener to make it possible to listen async for a SINGLE request.

Declaration
public static Task<T> ListenAsync<T>(Uri listenUri, Func<HttpListenerContext, Task<T>> httpListenerContextHandler, CancellationToken cancellationToken = null)
Parameters
Type Name Description
System.Uri listenUri

The Uri to listen to, use CreateFreeLocalHostUri (and add segments) if you don't have a specific reason

System.Func<System.Net.HttpListenerContext, System.Threading.Tasks.Task<T>> httpListenerContextHandler

A function which gets a HttpListenerContext and returns a value

System.Threading.CancellationToken cancellationToken

CancellationToken

Returns
Type Description
System.Threading.Tasks.Task<T>

The value from the httpListenerContextHandler