Skip to main content

AppHostHttpListenerBase

Inherit from this class if you want to host your web services inside a Console Application, Windows Service, etc.

Usage of HttpListener allows you to host webservices on the same port (:80) as IIS however it requires admin user privileges.

Assembly: ServiceStack.dll
View Source
Declaration
public abstract class AppHostHttpListenerBase : HttpListenerBase, IAppHost, IResolver, IFunqlet, IHasContainer, IDisposable

Properties

HandlerPath

View Source
Declaration
public string HandlerPath { get; set; }

Inherited Properties

BeforeRequest

View Source
Declaration
public Action<HttpListenerContext> BeforeRequest { get; set; }

Fields

ThreadsPerProcessor

View Source
Declaration
public static int ThreadsPerProcessor

Methods

CalculatePoolSize()

View Source
Declaration
public static int CalculatePoolSize()
Returns

System.Int32

ProcessRequestAsync(HttpListenerContext)

View Source
Declaration
protected override async Task ProcessRequestAsync(HttpListenerContext context)
Returns

System.Threading.Tasks.Task

Parameters
TypeName
System.Net.HttpListenerContextcontext

OnConfigLoad()

View Source
Declaration
public override void OnConfigLoad()

Inherited Methods

AddUrlReservationToAcl(String)

Reserves the specified URL for non-administrator users and accounts. http://msdn.microsoft.com/en-us/library/windows/desktop/cc307223(v=vs.85).aspx

View Source
Declaration
public static string AddUrlReservationToAcl(string urlBase)
Returns

System.String: Reserved Url if the process completes successfully

Parameters
TypeName
System.StringurlBase

CreateHttpListener()

View Source
Declaration
protected virtual HttpListener CreateHttpListener()
Returns

System.Net.HttpListener

CreateRequest(HttpListenerContext, String)

View Source
Declaration
public virtual ListenerRequest CreateRequest(HttpListenerContext httpContext, string operationName)
Returns

ServiceStack.Host.HttpListener.ListenerRequest

Parameters
TypeName
System.Net.HttpListenerContexthttpContext
System.StringoperationName

Dispose(Boolean)

View Source
Declaration
protected override void Dispose(bool disposing)
Parameters
TypeName
System.Booleandisposing

HandleError(Exception, HttpListenerContext)

View Source
Declaration
public static void HandleError(Exception ex, HttpListenerContext context)
Parameters
TypeName
System.Exceptionex
System.Net.HttpListenerContextcontext

Listen(Object)

View Source
Declaration
protected virtual void Listen(object state)
Parameters
TypeName
System.Objectstate

OnAfterInit()

View Source
Declaration
public override void OnAfterInit()

OnBeginRequest(HttpListenerContext)

View Source
Declaration
protected virtual void OnBeginRequest(HttpListenerContext context)
Parameters
TypeName
System.Net.HttpListenerContextcontext

ProcessRequestAsync(HttpListenerContext)

Overridable method that can be used to implement a custom handler

View Source
Declaration
protected abstract Task ProcessRequestAsync(HttpListenerContext context)
Returns

System.Threading.Tasks.Task

Parameters
TypeName
System.Net.HttpListenerContextcontext

ProcessRequestContext(HttpListenerContext)

View Source
Declaration
public virtual void ProcessRequestContext(HttpListenerContext context)
Parameters
TypeName
System.Net.HttpListenerContextcontext

RemoveUrlReservationFromAcl(String)

View Source
Declaration
public static void RemoveUrlReservationFromAcl(string urlBase)
Parameters
TypeName
System.StringurlBase

SetAppDomainData()

View Source
Declaration
public virtual void SetAppDomainData()

Start(IEnumerable<String>)

View Source
Declaration
public virtual ServiceStackHost Start(IEnumerable<string> urlBases)
Returns

ServiceStack.ServiceStackHost

Parameters
TypeName
System.Collections.Generic.IEnumerable<System.String>urlBases

Start(IEnumerable<String>, WaitCallback)

View Source
Declaration
protected void Start(IEnumerable<string> urlBases, WaitCallback listenCallback)
Parameters
TypeName
System.Collections.Generic.IEnumerable<System.String>urlBases
System.Threading.WaitCallbacklistenCallback

Start(String)

View Source
Declaration
public override ServiceStackHost Start(string urlBase)
Returns

ServiceStack.ServiceStackHost

Parameters
TypeName
System.StringurlBase

Start(String, WaitCallback)

Starts the Web Service

View Source
Declaration
protected void Start(string urlBase, WaitCallback listenCallback)
Parameters
TypeNameDescription
System.StringurlBase

A Uri that acts as the base that the server is listening on. Format should be: http://127.0.0.1:8080/ or http://127.0.0.1:8080/somevirtual/ Note: the trailing slash is required! For more info see the HttpListener.Prefixes property on MSDN.

| | System.Threading.WaitCallback | listenCallback |

|

Stop()

Shut down the Web Service

View Source
Declaration
public virtual void Stop()

WriteUnhandledErrorResponse(IRequest, Exception)

View Source
Declaration
public static void WriteUnhandledErrorResponse(IRequest httpReq, Exception ex)
Parameters
TypeName
ServiceStack.Web.IRequesthttpReq
System.Exceptionex

Implements