Skip to main content

GenericAppHost

Assembly: ServiceStack.dll
View Source
Declaration
public class GenericAppHost : ServiceStackHost, IAppHost, IResolver, IFunqlet, IHasContainer, IDisposable

Properties

ConfigureContainer

View Source
Declaration
public Action<Container> ConfigureContainer { get; set; }

ConfigureAppHost

View Source
Declaration
public Action<GenericAppHost> ConfigureAppHost { get; set; }

ConfigFilter

View Source
Declaration
public Action<HostConfig> ConfigFilter { get; set; }

Inherited Properties

AddVirtualFileSources

Append lower priority VFS providers at the end of the VFS providers list

View Source
Declaration
public List<IVirtualPathProvider> AddVirtualFileSources { get; set; }

AfterConfigure

Register callbacks fired just after AppHost.Configure()

View Source
Declaration
public List<Action<ServiceStackHost>> AfterConfigure { get; set; }

AfterInitAt

When the Init function was done. Called at begin of ServiceStack.ServiceStackHost.OnAfterInit()

View Source
Declaration
public DateTime? AfterInitAt { get; set; }

AfterInitCallbacks

Register callbacks that's fired after the AppHost is initialized

View Source
Declaration
public List<Action<IAppHost>> AfterInitCallbacks { get; set; }

AfterPluginsLoaded

Register callbacks fired just after plugins are loaded

View Source
Declaration
public List<Action<ServiceStackHost>> AfterPluginsLoaded { get; set; }

AppName

Sharp App Name

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

AppSettings

ServiceStack's Configuration API, see: https://docs.servicestack.net/appsettings

View Source
Declaration
public IAppSettings AppSettings { get; set; }

AsyncErrors

Captured Unobserved Async Errors

View Source
Declaration
public List<ResponseStatus> AsyncErrors { get; set; }

BeforeConfigure

Register callbacks fired just before AppHost.Configure()

View Source
Declaration
public List<Action<ServiceStackHost>> BeforeConfigure { get; set; }

CatchAllHandlers

Get "Catch All" IHttpHandler predicate IHttpHandler's, e.g. Used by HTML View Engines

View Source
Declaration
public List<HttpHandlerResolverDelegate> CatchAllHandlers { get; set; }

Config

The Configuration for this AppHost

View Source
Declaration
public HostConfig Config { get; set; }

Container

The AppHost.Container. Note: it is not thread safe to register dependencies after AppStart.

View Source
Declaration
public virtual Container Container { get; }

ContentRootDirectory

The Content Root Directory for this AppHost

View Source
Declaration
public IVirtualDirectory ContentRootDirectory { get; }

ContentTypes

Manage registered Content Types & their sync/async serializers supported by this AppHost

View Source
Declaration
public IContentTypes ContentTypes { get; set; }

CustomErrorHttpHandlers

Register Custom IServiceStackHandler to handle specific HttpStatusCode's

View Source
Declaration
public Dictionary<HttpStatusCode, IServiceStackHandler> CustomErrorHttpHandlers { get; set; }

DefaultScriptContext

The fallback ScriptContext to use if no SharpPagesFeature plugin was registered

View Source
Declaration
public ScriptContext DefaultScriptContext { get; set; }

ExcludeAutoRegisteringServiceTypes

View Source
Declaration
public HashSet<Type> ExcludeAutoRegisteringServiceTypes { get; set; }

FallbackHandlers

Register fallback Request Handlers e.g. Used by #Script & Razor Page Based Routing

View Source
Declaration
public List<HttpHandlerResolverDelegate> FallbackHandlers { get; set; }

GatewayExceptionHandlers

View Source
Declaration
public List<HandleGatewayExceptionDelegate> GatewayExceptionHandlers { get; set; }

GatewayExceptionHandlersAsync

View Source
Declaration
public List<HandleGatewayExceptionAsyncDelegate> GatewayExceptionHandlersAsync { get; set; }

GatewayRequestFilters

View Source
Declaration
public List<Action<IRequest, object>> GatewayRequestFilters { get; set; }

GatewayRequestFiltersAsync

View Source
Declaration
public List<Func<IRequest, object, Task>> GatewayRequestFiltersAsync { get; set; }

GatewayResponseFilters

View Source
Declaration
public List<Action<IRequest, object>> GatewayResponseFilters { get; set; }

GatewayResponseFiltersAsync

View Source
Declaration
public List<Func<IRequest, object, Task>> GatewayResponseFiltersAsync { get; set; }

GlobalAfterAppHostInit

Register static callbacks fired after the AppHost is initialized

View Source
Declaration
public static List<Action<ServiceStackHost>> GlobalAfterAppHostInit { get; }

GlobalAfterConfigure

Register static callbacks fired just after AppHost.Configure()

View Source
Declaration
public static List<Action<ServiceStackHost>> GlobalAfterConfigure { get; }

GlobalAfterPluginsLoaded

Register static callbacks fired just after plugins are loaded

View Source
Declaration
public static List<Action<ServiceStackHost>> GlobalAfterPluginsLoaded { get; }

GlobalBeforeConfigure

Register static callbacks fired just before AppHost.Configure()

View Source
Declaration
public static List<Action<ServiceStackHost>> GlobalBeforeConfigure { get; }

GlobalHtmlErrorHttpHandler

Fallback IServiceStackHandler to handle Error Responses

View Source
Declaration
public IServiceStackHandler GlobalHtmlErrorHttpHandler { get; set; }

GlobalMessageRequestFilters

View Source
Declaration
public List<Action<IRequest, IResponse, object>> GlobalMessageRequestFilters { get; }

GlobalMessageRequestFiltersAsync

View Source
Declaration
public List<Func<IRequest, IResponse, object, Task>> GlobalMessageRequestFiltersAsync { get; }

GlobalMessageResponseFilters

View Source
Declaration
public List<Action<IRequest, IResponse, object>> GlobalMessageResponseFilters { get; }

GlobalMessageResponseFiltersAsync

View Source
Declaration
public List<Func<IRequest, IResponse, object, Task>> GlobalMessageResponseFiltersAsync { get; }

GlobalRequestFilters

View Source
Declaration
public List<Action<IRequest, IResponse, object>> GlobalRequestFilters { get; set; }

GlobalRequestFiltersAsync

View Source
Declaration
public List<Func<IRequest, IResponse, object, Task>> GlobalRequestFiltersAsync { get; set; }

GlobalResponseFilters

View Source
Declaration
public List<Action<IRequest, IResponse, object>> GlobalResponseFilters { get; set; }

GlobalResponseFiltersAsync

View Source
Declaration
public List<Func<IRequest, IResponse, object, Task>> GlobalResponseFiltersAsync { get; set; }

GlobalTypedMessageRequestFilters

View Source
Declaration
public Dictionary<Type, ITypedFilter> GlobalTypedMessageRequestFilters { get; set; }

GlobalTypedMessageResponseFilters

View Source
Declaration
public Dictionary<Type, ITypedFilter> GlobalTypedMessageResponseFilters { get; set; }

GlobalTypedRequestFilters

View Source
Declaration
public Dictionary<Type, ITypedFilter> GlobalTypedRequestFilters { get; set; }

GlobalTypedRequestFiltersAsync

View Source
Declaration
public Dictionary<Type, ITypedFilterAsync> GlobalTypedRequestFiltersAsync { get; set; }

GlobalTypedResponseFilters

View Source
Declaration
public Dictionary<Type, ITypedFilter> GlobalTypedResponseFilters { get; set; }

GlobalTypedResponseFiltersAsync

View Source
Declaration
public Dictionary<Type, ITypedFilterAsync> GlobalTypedResponseFiltersAsync { get; set; }

HasInit

Whether AppHost has been already initialized

View Source
Declaration
public static bool HasInit { get; }

HasStarted

Whether AppHost configuration is done. Note: It doesn't mean the start function was called.

View Source
Declaration
public bool HasStarted { get; }

InsertVirtualFileSources

Insert higher priority VFS providers at the start of the VFS providers list

View Source
Declaration
public List<IVirtualPathProvider> InsertVirtualFileSources { get; set; }

Instance

Singleton access to AppHost

View Source
Declaration
public static ServiceStackHost Instance { get; protected set; }

IsDebugLogEnabled

View Source
Declaration
public bool IsDebugLogEnabled { get; }

Metadata

The populated Metadata for this AppHost's Services

View Source
Declaration
public ServiceMetadata Metadata { get; set; }

MetadataPagesConfig

Configuration of ServiceStack's /metadata pages

View Source
Declaration
public MetadataPagesConfig MetadataPagesConfig { get; }

OnAfterPluginsLoaded

View Source
Declaration
public Dictionary<Type, List<Action<IPlugin>>> OnAfterPluginsLoaded { get; set; }

OnDisposeCallbacks

Register callbacks that's fired when AppHost is disposed

View Source
Declaration
public List<Action<IAppHost>> OnDisposeCallbacks { get; set; }

OnEndRequestCallbacks

Register callbacks to execute at the end of a Request

View Source
Declaration
public List<Action<IRequest>> OnEndRequestCallbacks { get; set; }

OnPostRegisterPlugins

View Source
Declaration
public Dictionary<Type, List<Action<IPlugin>>> OnPostRegisterPlugins { get; set; }

OnPreRegisterPlugins

View Source
Declaration
public Dictionary<Type, List<Action<IPlugin>>> OnPreRegisterPlugins { get; set; }

PathBase

The base path ServiceStack is hosted on

View Source
Declaration
public virtual string PathBase { get; set; }

Plugins

Collection of added plugins.

View Source
Declaration
public List<IPlugin> Plugins { get; set; }

PluginsLoaded

Which plugins were loaded in this AppHost

View Source
Declaration
public List<string> PluginsLoaded { get; set; }

PreRequestFilters

Collection of PreRequest filters. They are called before each request is handled by a service, but after an HttpHandler is by the ServiceStack.HttpHandlerFactory chosen. called in ServiceStack.ServiceStackHost.ApplyPreRequestFilters(ServiceStack.Web.IRequest%2cServiceStack.Web.IResponse).

View Source
Declaration
public List<Action<IRequest, IResponse>> PreRequestFilters { get; set; }

RawHttpHandlers

Register highest priority IHttpHandler callbacks

View Source
Declaration
public List<Func<IHttpRequest, IHttpHandler>> RawHttpHandlers { get; set; }

ReadyAt

When all configuration was completed. Called at the end of ServiceStack.ServiceStackHost.OnAfterInit()

View Source
Declaration
public DateTime? ReadyAt { get; set; }

RequestBinders

Register custom Request Binder

View Source
Declaration
public Dictionary<Type, Func<IRequest, object>> RequestBinders { get; }

RequestConverters

Collection of RequestConverters. Can be used to convert/change Input Dto Called after routing and model binding, but before request filters. All request converters are called unless ServiceStack.Web.IResponse.IsClosed Converter can return null, original model will be used.

Note one converter could influence the input for the next converter!

View Source
Declaration
public List<Func<IRequest, object, Task<object>>> RequestConverters { get; set; }

ResponseConverters

Collection of ResponseConverters. Can be used to convert/change Output Dto

Called directly after response is handled, even before ServiceStack.ServiceStackHost.ApplyResponseFiltersAsync(ServiceStack.Web.IRequest%2cServiceStack.Web.IResponse%2cSystem.Object)!

View Source
Declaration
public List<Func<IRequest, object, Task<object>>> ResponseConverters { get; set; }

RestPaths

Registered Routes

View Source
Declaration
public List<RestPath> RestPaths { get; set; }

RootDirectory

FileSystem VFS for WebRoot

View Source
Declaration
public IVirtualDirectory RootDirectory { get; }

Routes

Dynamically register Service Routes

View Source
Declaration
public IServiceRoutes Routes { get; set; }

RpcGateway

Provides a pure object model for executing the full HTTP Request pipeline which returns the Response DTO back to ASP .NET Core gRPC which handles sending the response back to the HTTP/2 connected client.

View Source
Declaration
public RpcGateway RpcGateway { get; set; }

ScriptContext

Global #Script ScriptContext for AppHost. Returns SharpPagesFeature plugin or fallsback to DefaultScriptContext.

View Source
Declaration
public ScriptContext ScriptContext { get; }

ServiceAssemblies

The assemblies reflected to find api services. These can be provided in the constructor call.

View Source
Declaration
public List<Assembly> ServiceAssemblies { get; }

ServiceController

The ServiceController that executes Services

View Source
Declaration
public ServiceController ServiceController { get; set; }

ServiceExceptionHandlers

View Source
Declaration
public List<HandleServiceExceptionDelegate> ServiceExceptionHandlers { get; set; }

ServiceExceptionHandlersAsync

View Source
Declaration
public List<HandleServiceExceptionAsyncDelegate> ServiceExceptionHandlersAsync { get; set; }

ServiceName

The public name of this App

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

StartedAt

When the AppHost was instantiated.

View Source
Declaration
public DateTime StartedAt { get; set; }

StartUpErrors

Captured StartUp Exceptions

View Source
Declaration
public List<ResponseStatus> StartUpErrors { get; set; }

TestMode

If app currently runs for unit tests. Used for overwriting AuthSession.

View Source
Declaration
public bool TestMode { get; set; }

UncaughtExceptionHandlers

View Source
Declaration
public List<HandleUncaughtExceptionDelegate> UncaughtExceptionHandlers { get; set; }

UncaughtExceptionHandlersAsync

View Source
Declaration
public List<HandleUncaughtExceptionAsyncDelegate> UncaughtExceptionHandlersAsync { get; set; }

ViewEngines

Lists of view engines for this app. If view is needed list is looped until view is found.

View Source
Declaration
public List<IViewEngine> ViewEngines { get; set; }

VirtualFiles

Writable Virtual File Source, uses FileSystemVirtualFiles at content root by default

View Source
Declaration
public IVirtualFiles VirtualFiles { get; set; }

VirtualFileSources

Virtual File Sources from WebRoot, typically a MultiVirtualFiles containing a cascading list of Sources

View Source
Declaration
public IVirtualPathProvider VirtualFileSources { get; set; }

Methods

Configure(Container)

View Source
Declaration
public override void Configure(Container container)
Parameters
TypeName
Funq.Containercontainer

GetServiceGateway(IRequest)

View Source
Declaration
public override IServiceGateway GetServiceGateway(IRequest req)
Returns

ServiceStack.IServiceGateway

Parameters
TypeName
ServiceStack.Web.IRequestreq

OnConfigLoad()

View Source
Declaration
public override void OnConfigLoad()

Inherited Methods

AfterPluginLoaded<T>(Action<T>)

Register a callback to configure a plugin after AfterPluginsLoaded is run

View Source
Declaration
public void AfterPluginLoaded<T>(Action<T> configure)
where T : class, IPlugin
Parameters
TypeName
System.Action<<T>>configure
Type Parameters
  • T

AllowSetCookie(IRequest, String)

View Source
Declaration
[Obsolete("Override SetCookieFilter")]
protected virtual bool AllowSetCookie(IRequest req, string cookieName)
Returns

System.Boolean

Parameters
TypeName
ServiceStack.Web.IRequestreq
System.StringcookieName

ApplyCustomHandlerRequestFilters(IRequest, IResponse)

Apply PreRequest Filters for participating Custom Handlers, e.g. RazorFormat, MarkdownFormat, etc

View Source
Declaration
public bool ApplyCustomHandlerRequestFilters(IRequest httpReq, IResponse httpRes)
Returns

System.Boolean

Parameters
TypeName
ServiceStack.Web.IRequesthttpReq
ServiceStack.Web.IResponsehttpRes

ApplyGatewayRequestFiltersAsync(IRequest, Object)

Execute Service Gateway Request Filters

View Source
Declaration
public async Task<bool> ApplyGatewayRequestFiltersAsync(IRequest req, object request)
Returns

System.Threading.Tasks.Task<System.Boolean>

Parameters
TypeName
ServiceStack.Web.IRequestreq
System.Objectrequest

ApplyGatewayRespoonseFiltersAsync(IRequest, Object)

Execute Service Gateway Response Filters

View Source
Declaration
public async Task<bool> ApplyGatewayRespoonseFiltersAsync(IRequest req, object responseDto)
Returns

System.Threading.Tasks.Task<System.Boolean>

Parameters
TypeName
ServiceStack.Web.IRequestreq
System.ObjectresponseDto

ApplyMessageRequestFilters(IRequest, IResponse, Object)

Executes MQ Response Filters

View Source
Declaration
public bool ApplyMessageRequestFilters(IRequest req, IResponse res, object requestDto)
Returns

System.Boolean

Parameters
TypeName
ServiceStack.Web.IRequestreq
ServiceStack.Web.IResponseres
System.ObjectrequestDto

ApplyMessageResponseFilters(IRequest, IResponse, Object)

Executes MQ Response Filters

View Source
Declaration
public bool ApplyMessageResponseFilters(IRequest req, IResponse res, object response)
Returns

System.Boolean

Parameters
TypeName
ServiceStack.Web.IRequestreq
ServiceStack.Web.IResponseres
System.Objectresponse

ApplyPreAuthenticateFiltersAsync(IRequest, IResponse)

Apply PreAuthenticate Filters from IAuthWithRequest AuthProviders

View Source
Declaration
public virtual async Task ApplyPreAuthenticateFiltersAsync(IRequest httpReq, IResponse httpRes)
Returns

System.Threading.Tasks.Task

Parameters
TypeName
ServiceStack.Web.IRequesthttpReq
ServiceStack.Web.IResponsehttpRes

ApplyPreRequestFilters(IRequest, IResponse)

Applies the raw request filters. Returns whether or not the request has been handled and no more processing should be done.

View Source
Declaration
public bool ApplyPreRequestFilters(IRequest httpReq, IResponse httpRes)
Returns

System.Boolean

Parameters
TypeName
ServiceStack.Web.IRequesthttpReq
ServiceStack.Web.IResponsehttpRes

ApplyRequestConvertersAsync(IRequest, Object)

Executes Service Request Converters

View Source
Declaration
public async Task<object> ApplyRequestConvertersAsync(IRequest req, object requestDto)
Returns

System.Threading.Tasks.Task<System.Object>

Parameters
TypeName
ServiceStack.Web.IRequestreq
System.ObjectrequestDto

ApplyRequestFilters(IRequest, IResponse, Object)

View Source
Declaration
[Obsolete("Use ApplyRequestFiltersAsync")]
public bool ApplyRequestFilters(IRequest req, IResponse res, object requestDto)
Returns

System.Boolean

Parameters
TypeName
ServiceStack.Web.IRequestreq
ServiceStack.Web.IResponseres
System.ObjectrequestDto

ApplyRequestFiltersAsync(IRequest, IResponse, Object)

Applies the request filters. Returns whether or not the request has been handled and no more processing should be done.

View Source
Declaration
public async Task ApplyRequestFiltersAsync(IRequest req, IResponse res, object requestDto)
Returns

System.Threading.Tasks.Task

Parameters
TypeName
ServiceStack.Web.IRequestreq
ServiceStack.Web.IResponseres
System.ObjectrequestDto

ApplyRequestFiltersSingleAsync(IRequest, IResponse, Object)

Executes Service Request Filters

View Source
Declaration
protected async Task ApplyRequestFiltersSingleAsync(IRequest req, IResponse res, object requestDto)
Returns

System.Threading.Tasks.Task

Parameters
TypeName
ServiceStack.Web.IRequestreq
ServiceStack.Web.IResponseres
System.ObjectrequestDto

ApplyResponseConvertersAsync(IRequest, Object)

Executes Service Response Converters

View Source
Declaration
public async Task<object> ApplyResponseConvertersAsync(IRequest req, object responseDto)
Returns

System.Threading.Tasks.Task<System.Object>

Parameters
TypeName
ServiceStack.Web.IRequestreq
System.ObjectresponseDto

ApplyResponseFilters(IRequest, IResponse, Object)

View Source
Declaration
[Obsolete("Use ApplyResponseFiltersAsync")]
public bool ApplyResponseFilters(IRequest req, IResponse res, object response)
Returns

System.Boolean

Parameters
TypeName
ServiceStack.Web.IRequestreq
ServiceStack.Web.IResponseres
System.Objectresponse

ApplyResponseFiltersAsync(IRequest, IResponse, Object)

Applies the response filters. Returns whether or not the request has been handled and no more processing should be done.

View Source
Declaration
public async Task ApplyResponseFiltersAsync(IRequest req, IResponse res, object response)
Returns

System.Threading.Tasks.Task

Parameters
TypeName
ServiceStack.Web.IRequestreq
ServiceStack.Web.IResponseres
System.Objectresponse

ApplyResponseFiltersSingleAsync(IRequest, IResponse, Object)

Executes Service Response Filters

View Source
Declaration
protected async Task ApplyResponseFiltersSingleAsync(IRequest req, IResponse res, object response)
Returns

System.Threading.Tasks.Task

Parameters
TypeName
ServiceStack.Web.IRequestreq
ServiceStack.Web.IResponseres
System.Objectresponse

AssertAuthenticated(IAuthSession, IRequest)

Default logic to determine whether a Session is Authenticated

View Source
Declaration
public virtual IAuthSession AssertAuthenticated(IAuthSession session, IRequest req = null)
Returns

ServiceStack.Auth.IAuthSession

Parameters
TypeName
ServiceStack.Auth.IAuthSessionsession
ServiceStack.Web.IRequestreq

AssertContentType(String)

Assert whether this App should server this contentType

View Source
Declaration
public void AssertContentType(string contentType)
Parameters
TypeName
System.StringcontentType

AssertFeatures(Feature)

Assert whether this App supports this feature

View Source
Declaration
public void AssertFeatures(Feature usesFeatures)
Parameters
TypeName
ServiceStack.FeatureusesFeatures

AuthenticationRequired(IServiceBase)

View Source
Declaration
public virtual IHttpResult AuthenticationRequired(IServiceBase service)
Returns

ServiceStack.Web.IHttpResult

Parameters
TypeName
ServiceStack.IServiceBaseservice

Configure(Container)

Configure your AppHost and its dependencies

View Source
Declaration
public abstract void Configure(Container container)
Parameters
TypeName
Funq.Containercontainer

ConfigureLogging()

View Source
Declaration
public virtual void ConfigureLogging()

ConfigurePlugin<T>(Action<T>)

Register a callback to configure a plugin just before it's registered

View Source
Declaration
public void ConfigurePlugin<T>(Action<T> configure)
where T : class, IPlugin
Parameters
TypeName
System.Action<<T>>configure
Type Parameters
  • T

CreateErrorResponse(Exception, Object)

Override to customize converting an Exception into a generic ErrorResponse DTO

View Source
Declaration
public virtual ErrorResponse CreateErrorResponse(Exception ex, object request = null)
Returns

ServiceStack.ErrorResponse

Parameters
TypeName
System.Exceptionex
System.Objectrequest

CreateResponseStatus(Exception, Object)

Override to customize converting an Exception into the ResponseStatus DTO

View Source
Declaration
public virtual ResponseStatus CreateResponseStatus(Exception ex, object request = null)
Returns

ServiceStack.ResponseStatus

Parameters
TypeName
System.Exceptionex
System.Objectrequest

CreateServiceController(Assembly[])

View Source
Declaration
protected virtual ServiceController CreateServiceController(params Assembly[] assembliesWithServices)
Returns

ServiceStack.Host.ServiceController

Parameters
TypeName
System.Reflection.Assembly[]assembliesWithServices

CreateServiceController(Type[])

View Source
Declaration
protected virtual ServiceController CreateServiceController(params Type[] serviceTypes)
Returns

ServiceStack.Host.ServiceController

Parameters
TypeName
System.Type[]serviceTypes

CreateServiceRunner<TRequest>(ActionContext)

Override to use a Custom ServiceRunner to execute this Request DTO

View Source
Declaration
public virtual IServiceRunner<TRequest> CreateServiceRunner<TRequest>(ActionContext actionContext)
Returns

ServiceStack.Web.IServiceRunner<TRequest>

Parameters
TypeName
ServiceStack.Host.ActionContextactionContext
Type Parameters
  • TRequest

Dispose()

View Source
Declaration
public void Dispose()

Dispose(Boolean)

Executes OnDisposeCallbacks and Disposes IDisposable's dependencies in the IOC & reset singleton states

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

EvalExpression(String)

View Source
Declaration
public virtual object EvalExpression(string expr)
Returns

System.Object

Parameters
TypeName
System.Stringexpr

EvalExpressionCached(String)

Evaluate Expressions in ServiceStack's ScriptContext. Can be overridden if you want to customize how different expressions are evaluated.

View Source
Declaration
public virtual object EvalExpressionCached(string expr)
Returns

System.Object

Parameters
TypeName
System.Stringexpr

EvalScript(PageResult, IRequest, Dictionary<String, Object>)

Override to intercept sync #Script execution

View Source
Declaration
public virtual object EvalScript(PageResult pageResult, IRequest req = null, Dictionary<string, object> args = null)
Returns

System.Object

Parameters
TypeName
ServiceStack.Script.PageResultpageResult
ServiceStack.Web.IRequestreq
System.Collections.Generic.Dictionary<System.String,System.Object>args

EvalScriptAsync(PageResult, IRequest, Dictionary<String, Object>)

Override to intercept async #Script execution

View Source
Declaration
public virtual async Task<object> EvalScriptAsync(PageResult pageResult, IRequest req = null, Dictionary<string, object> args = null)
Returns

System.Threading.Tasks.Task<System.Object>

Parameters
TypeName
ServiceStack.Script.PageResultpageResult
ServiceStack.Web.IRequestreq
System.Collections.Generic.Dictionary<System.String,System.Object>args

EvalScriptValue(IScriptValue, IRequest, Dictionary<String, Object>)

Evaluate a script value, IScriptValue.Expression results are cached globally. If IRequest is provided, results from the same IScriptValue.Eval are cached per request.

View Source
Declaration
public virtual object EvalScriptValue(IScriptValue scriptValue, IRequest req = null, Dictionary<string, object> args = null)
Returns

System.Object

Parameters
TypeName
ServiceStack.IScriptValuescriptValue
ServiceStack.Web.IRequestreq
System.Collections.Generic.Dictionary<System.String,System.Object>args

EvalScriptValueAsync(IScriptValue, IRequest, Dictionary<String, Object>)

Evaluate a script value, IScriptValue.Expression results are cached globally. If IRequest is provided, results from the same IScriptValue.Eval are cached per request.

View Source
Declaration
public virtual async Task<object> EvalScriptValueAsync(IScriptValue scriptValue, IRequest req = null, Dictionary<string, object> args = null)
Returns

System.Threading.Tasks.Task<System.Object>

Parameters
TypeName
ServiceStack.IScriptValuescriptValue
ServiceStack.Web.IRequestreq
System.Collections.Generic.Dictionary<System.String,System.Object>args

ExecTypedFilters(Dictionary<Type, ITypedFilter>, IRequest, IResponse, Object)

Executes Typed Request Filters

View Source
Declaration
public void ExecTypedFilters(Dictionary<Type, ITypedFilter> typedFilters, IRequest req, IResponse res, object dto)
Parameters
TypeName
System.Collections.Generic.Dictionary<System.Type,ServiceStack.Host.ITypedFilter>typedFilters
ServiceStack.Web.IRequestreq
ServiceStack.Web.IResponseres
System.Objectdto

ExecTypedFiltersAsync(Dictionary<Type, ITypedFilterAsync>, IRequest, IResponse, Object)

Executes Typed Request Filters

View Source
Declaration
public async Task ExecTypedFiltersAsync(Dictionary<Type, ITypedFilterAsync> typedFilters, IRequest req, IResponse res, object dto)
Returns

System.Threading.Tasks.Task

Parameters
TypeName
System.Collections.Generic.Dictionary<System.Type,ServiceStack.Host.ITypedFilterAsync>typedFilters
ServiceStack.Web.IRequestreq
ServiceStack.Web.IResponseres
System.Objectdto

ExecuteMessage(IMessage)

Override to intercept MQ Requests

View Source
Declaration
public virtual object ExecuteMessage(IMessage mqMessage)
Returns

System.Object

Parameters
TypeName
ServiceStack.Messaging.IMessagemqMessage

ExecuteMessage(IMessage, IRequest)

Override to intercept MQ Requests

View Source
Declaration
public virtual object ExecuteMessage(IMessage dto, IRequest req)
Returns

System.Object

Parameters
TypeName
ServiceStack.Messaging.IMessagedto
ServiceStack.Web.IRequestreq

ExecuteMessageAsync(IMessage, IRequest, CancellationToken)

Override to intercept MQ Requests

View Source
Declaration
public Task<object> ExecuteMessageAsync(IMessage mqMessage, IRequest req, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task<System.Object>

Parameters
TypeName
ServiceStack.Messaging.IMessagemqMessage
ServiceStack.Web.IRequestreq
System.Threading.CancellationTokentoken

ExecuteMessageAsync(IMessage, CancellationToken)

Override to intercept MQ Requests

View Source
Declaration
public Task<object> ExecuteMessageAsync(IMessage mqMessage, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task<System.Object>

Parameters
TypeName
ServiceStack.Messaging.IMessagemqMessage
System.Threading.CancellationTokentoken

ExecuteService(Object)

Override to intercept Service Requests

View Source
Declaration
public virtual object ExecuteService(object requestDto)
Returns

System.Object

Parameters
TypeName
System.ObjectrequestDto

ExecuteService(Object, RequestAttributes)

Override to intercept Service Requests

View Source
Declaration
public virtual object ExecuteService(object requestDto, RequestAttributes requestAttributes)
Returns

System.Object

Parameters
TypeName
System.ObjectrequestDto
ServiceStack.RequestAttributesrequestAttributes

ExecuteService(Object, IRequest)

Override to intercept Service Requests

View Source
Declaration
public virtual object ExecuteService(object requestDto, IRequest req)
Returns

System.Object

Parameters
TypeName
System.ObjectrequestDto
ServiceStack.Web.IRequestreq

ExecuteServiceAsync(Object, IRequest)

Override to intercept Async Service Requests

View Source
Declaration
public virtual Task<object> ExecuteServiceAsync(object requestDto, IRequest req)
Returns

System.Threading.Tasks.Task<System.Object>

Parameters
TypeName
System.ObjectrequestDto
ServiceStack.Web.IRequestreq

ExportSoapOperationTypes(List<Type>)

View Source
Declaration
public virtual List<Type> ExportSoapOperationTypes(List<Type> operationTypes)
Returns

System.Collections.Generic.List<System.Type>

Parameters
TypeName
System.Collections.Generic.List<System.Type>operationTypes

ExportSoapType(Type)

View Source
Declaration
public virtual bool ExportSoapType(Type type)
Returns

System.Boolean

Parameters
TypeName
System.Typetype

Finalize()

View Source
Declaration
protected void Finalize()

GenerateWsdl(WsdlTemplateBase)

Override to customize WSDL returned in SOAP /metadata pages

View Source
Declaration
public virtual string GenerateWsdl(WsdlTemplateBase wsdlTemplate)
Returns

System.String

Parameters
TypeName
ServiceStack.Metadata.WsdlTemplateBasewsdlTemplate

GetAuthorization(IRequest)

Override Authorization Header resolution

View Source
Declaration
public virtual string GetAuthorization(IRequest req)
Returns

System.String

Parameters
TypeName
ServiceStack.Web.IRequestreq

GetAuthRepository(IRequest)

Gets the registered ServiceStack.Auth.IAuthRepository

View Source
Declaration
public virtual IAuthRepository GetAuthRepository(IRequest req = null)
Returns

ServiceStack.Auth.IAuthRepository

Parameters
TypeName
ServiceStack.Web.IRequestreq

GetAuthRepositoryAsync(IRequest)

Gets the registered ServiceStack.Auth.IAuthRepositoryAsync Returns native IAuthRepositoryAsync if exists, a sync wrapper if IAuthRepository exists, otherwise null.

View Source
Declaration
public virtual IAuthRepositoryAsync GetAuthRepositoryAsync(IRequest req = null)
Returns

ServiceStack.Auth.IAuthRepositoryAsync

Parameters
TypeName
ServiceStack.Web.IRequestreq

GetBaseUrl(IRequest)

Override to customize the BaseUrl to use for this IRequest

View Source
Declaration
public virtual string GetBaseUrl(IRequest httpReq)
Returns

System.String

Parameters
TypeName
ServiceStack.Web.IRequesthttpReq

GetBearerToken(IRequest)

Override Authorization Bearer Token resolution

View Source
Declaration
public virtual string GetBearerToken(IRequest req)
Returns

System.String

Parameters
TypeName
ServiceStack.Web.IRequestreq

GetCacheClient(IRequest)

Tries to resolve ServiceStack.Caching.ICacheClient through IoC container. If not registered, it falls back to ServiceStack.Redis.IRedisClientsManager.GetClient(), otherwise returns DefaultCache MemoryCacheClient

View Source
Declaration
public virtual ICacheClient GetCacheClient(IRequest req = null)
Returns

ServiceStack.Caching.ICacheClient

Parameters
TypeName
ServiceStack.Web.IRequestreq

GetCacheClientAsync(IRequest)

Get registered ICacheClientAsync otherwise returns async wrapped sync ICacheClient

View Source
Declaration
public virtual ICacheClientAsync GetCacheClientAsync(IRequest req = null)
Returns

ServiceStack.Caching.ICacheClientAsync

Parameters
TypeName
ServiceStack.Web.IRequestreq

GetCompressionType(IRequest)

View Source
Declaration
public virtual string GetCompressionType(IRequest request)
Returns

System.String

Parameters
TypeName
ServiceStack.Web.IRequestrequest

GetCookies(IHttpResponse)

Return the ICookies implementation to use

View Source
Declaration
public virtual ICookies GetCookies(IHttpResponse res)
Returns

ServiceStack.Web.ICookies

Parameters
TypeName
ServiceStack.Web.IHttpResponseres

GetCustomErrorHandler(Int32)

Override to customize the IServiceStackHandler that should handle the specified errorStatusCode

View Source
Declaration
public IServiceStackHandler GetCustomErrorHandler(int errorStatusCode)
Returns

ServiceStack.Host.Handlers.IServiceStackHandler

Parameters
TypeName
System.Int32errorStatusCode

GetCustomErrorHandler(HttpStatusCode)

Override to customize the IServiceStackHandler that should handle the specified HttpStatusCode

View Source
Declaration
public IServiceStackHandler GetCustomErrorHandler(HttpStatusCode errorStatus)
Returns

ServiceStack.Host.Handlers.IServiceStackHandler

Parameters
TypeName
System.Net.HttpStatusCodeerrorStatus

GetCustomErrorHttpHandler(HttpStatusCode)

Override to customize the IHttpHandler that should handle the specified HttpStatusCode

View Source
Declaration
public IHttpHandler GetCustomErrorHttpHandler(HttpStatusCode errorStatus)
Returns

System.Web.IHttpHandler

Parameters
TypeName
System.Net.HttpStatusCodeerrorStatus

GetDbConnection(IRequest)

Gets IDbConnection Checks if DbInfo is seat in RequestContext. See multitenancy: https://docs.servicestack.net/multitenancy Called by itself, ServiceStack.Service and ViewPageBase

View Source
Declaration
public virtual IDbConnection GetDbConnection(IRequest req = null)
Returns

System.Data.IDbConnection

Parameters
TypeNameDescription
ServiceStack.Web.IRequestreqProvided by services and pageView, can be helpful when overriding this method

|

GetDbConnection(String)

View Source
Declaration
public virtual IDbConnection GetDbConnection(string namedConnection)
Returns

System.Data.IDbConnection

Parameters
TypeName
System.StringnamedConnection

GetDbNamedConnection(IRequest)

View Source
Declaration
public virtual string GetDbNamedConnection(IRequest req)
Returns

System.String

Parameters
TypeName
ServiceStack.Web.IRequestreq

GetDefaultSessionExpiry(IRequest)

Return the Default Session Expiry for this Request

View Source
Declaration
public virtual TimeSpan GetDefaultSessionExpiry(IRequest req)
Returns

System.TimeSpan

Parameters
TypeName
ServiceStack.Web.IRequestreq

GetJwtRefreshToken(IRequest)

Override JWT Refresh Token resolution

View Source
Declaration
public virtual string GetJwtRefreshToken(IRequest req)
Returns

System.String

Parameters
TypeName
ServiceStack.Web.IRequestreq

GetJwtToken(IRequest)

Override JWT Token resolution

View Source
Declaration
public virtual string GetJwtToken(IRequest req)
Returns

System.String

Parameters
TypeName
ServiceStack.Web.IRequestreq

GetMemoryCacheClient(IRequest)

Returns ServiceStack.Caching.MemoryCacheClient. cache is only persisted for this running app instance. Called by ServiceStack.Service.MemoryCacheClient

View Source
Declaration
public virtual MemoryCacheClient GetMemoryCacheClient(IRequest req = null)
Returns

ServiceStack.Caching.MemoryCacheClient: Nullable MemoryCacheClient

Parameters
TypeNameDescription
ServiceStack.Web.IRequestreqProvided by services and pageView, can be helpful when overriding this method

|

GetMessageProducer(IRequest)

Returns ServiceStack.Messaging.IMessageProducer from the IOC container. Called by itself, ServiceStack.Service and ViewPageBase

View Source
Declaration
public virtual IMessageProducer GetMessageProducer(IRequest req = null)
Returns

ServiceStack.Messaging.IMessageProducer

Parameters
TypeNameDescription
ServiceStack.Web.IRequestreqProvided by services and PageViewBase, can be helpful when overriding this method

|

GetMetadataPluginIds()

Override to alter what registered plugins you want discoverable (used by ServiceStack Studio to enable features).

View Source
Declaration
public virtual List<string> GetMetadataPluginIds()
Returns

System.Collections.Generic.List<System.String>

GetNotFoundHandler()

Override to change the IServiceStackHandler that should handle 404 NotFount Responses

View Source
Declaration
public IServiceStackHandler GetNotFoundHandler()
Returns

ServiceStack.Host.Handlers.IServiceStackHandler

GetPlugin(Type)

Looks for first plugin of this type in Plugins.

View Source
Declaration
public IPlugin GetPlugin(Type pluginType)
Returns

ServiceStack.IPlugin

Parameters
TypeName
System.TypepluginType

GetPlugin<T>()

Looks for first plugin of this type in Plugins.

View Source
Declaration
public T GetPlugin<T>()
where T : class, IPlugin
Returns

<T>

Type Parameters
  • T

GetRedisClient(IRequest)

Resolves ServiceStack.Redis.IRedisClient based on ServiceStack.Redis.IRedisClientsManager.GetClient(); Called by itself, ServiceStack.Service and ViewPageBase

View Source
Declaration
public virtual IRedisClient GetRedisClient(IRequest req = null)
Returns

ServiceStack.Redis.IRedisClient

Parameters
TypeNameDescription
ServiceStack.Web.IRequestreqProvided by services and pageView, can be helpful when overriding this method

|

GetRedisClientAsync(IRequest)

Resolves ServiceStack.Redis.IRedisClient based on ServiceStack.Redis.IRedisClientsManager.GetClient(); Called by itself, ServiceStack.Service and ViewPageBase

View Source
Declaration
public virtual ValueTask<IRedisClientAsync> GetRedisClientAsync(IRequest req = null)
Returns

ValueTask<ServiceStack.Redis.IRedisClientAsync>

Parameters
TypeNameDescription
ServiceStack.Web.IRequestreqProvided by services and pageView, can be helpful when overriding this method

|

GetRefreshToken(IRequest)

Override Authorization Refresh Token resolution

View Source
Declaration
public virtual string GetRefreshToken(IRequest req)
Returns

System.String

Parameters
TypeName
ServiceStack.Web.IRequestreq

GetRouteAttributes(Type)

Return the [Route] attributes for this Request DTO Type

View Source
Declaration
public virtual RouteAttribute[] GetRouteAttributes(Type requestType)
Returns

ServiceStack.RouteAttribute[]

Parameters
TypeName
System.TyperequestType

GetRuntimeConfig<T>(IRequest, String, T)

Allow overriding ServiceStack runtime config like JWT Keys

View Source
Declaration
public virtual T GetRuntimeConfig<T>(IRequest req, string name, T defaultValue)
Returns

<T>

Parameters
TypeName
ServiceStack.Web.IRequestreq
System.Stringname
<T>defaultValue
Type Parameters
  • T

GetServiceGateway()

Get the configured ServiceStack.IServiceGateway

View Source
Declaration
public virtual IServiceGateway GetServiceGateway()
Returns

ServiceStack.IServiceGateway

GetServiceGateway(IRequest)

Get the configured ServiceStack.IServiceGateway for this request.

View Source
Declaration
public virtual IServiceGateway GetServiceGateway(IRequest req)
Returns

ServiceStack.IServiceGateway

Parameters
TypeName
ServiceStack.Web.IRequestreq

GetTypesConfigForMetadata(IRequest)

Override to customize what DTOs are displayed on metadata pages

View Source
Declaration
public virtual MetadataTypesConfig GetTypesConfigForMetadata(IRequest req)
Returns

ServiceStack.MetadataTypesConfig

Parameters
TypeName
ServiceStack.Web.IRequestreq

GetVirtualFileSource<T>()

View Source
Declaration
public virtual T GetVirtualFileSource<T>()
where T : class
Returns

<T>

Type Parameters
  • T

GetVirtualFileSources()

Override to intercept VFS Providers registered for this AppHost

View Source
Declaration
public virtual List<IVirtualPathProvider> GetVirtualFileSources()
Returns

System.Collections.Generic.List<ServiceStack.IO.IVirtualPathProvider>

GetWebRootPath()

Gets Full Directory Path of where the app is running

View Source
Declaration
public virtual string GetWebRootPath()
Returns

System.String

HandleErrorResponse(IRequest, IResponse, HttpStatusCode, String)

Override to handle Forbidden Feature Error Responses

View Source
Declaration
public void HandleErrorResponse(IRequest httpReq, IResponse httpRes, HttpStatusCode errorStatus, string errorStatusDescription = null)
Parameters
TypeName
ServiceStack.Web.IRequesthttpReq
ServiceStack.Web.IResponsehttpRes
System.Net.HttpStatusCodeerrorStatus
System.StringerrorStatusDescription

HandleResponseException(IRequest, IResponse, String, Exception)

Override to intercept Response Exceptions

View Source
Declaration
public virtual Task HandleResponseException(IRequest httpReq, IResponse httpRes, string operationName, Exception ex)
Returns

System.Threading.Tasks.Task

Parameters
TypeName
ServiceStack.Web.IRequesthttpReq
ServiceStack.Web.IResponsehttpRes
System.StringoperationName
System.Exceptionex

HandleShortCircuitedErrors(IRequest, IResponse, Object)

Override to intercept Short Circuited Authentication Errors

View Source
Declaration
public virtual async Task HandleShortCircuitedErrors(IRequest req, IResponse res, object requestDto)
Returns

System.Threading.Tasks.Task

Parameters
TypeName
ServiceStack.Web.IRequestreq
ServiceStack.Web.IResponseres
System.ObjectrequestDto

HandleShortCircuitedErrors(IRequest, IResponse, Object, HttpStatusCode, String)

View Source
Declaration
public virtual Task HandleShortCircuitedErrors(IRequest req, IResponse res, object requestDto, HttpStatusCode statusCode, string statusDescription = null)
Returns

System.Threading.Tasks.Task

Parameters
TypeName
ServiceStack.Web.IRequestreq
ServiceStack.Web.IResponseres
System.ObjectrequestDto
System.Net.HttpStatusCodestatusCode
System.StringstatusDescription

HandleUncaughtException(IRequest, IResponse, String, Exception)

View Source
Declaration
[Obsolete("Use HandleResponseException")]
protected virtual Task HandleUncaughtException(IRequest httpReq, IResponse httpRes, string operationName, Exception ex)
Returns

System.Threading.Tasks.Task

Parameters
TypeName
ServiceStack.Web.IRequesthttpReq
ServiceStack.Web.IResponsehttpRes
System.StringoperationName
System.Exceptionex

HasAccessToMetadata(IRequest, IResponse)

Override to return whether this request can access the metadata for the request

View Source
Declaration
public bool HasAccessToMetadata(IRequest httpReq, IResponse httpRes)
Returns

System.Boolean

Parameters
TypeName
ServiceStack.Web.IRequesthttpReq
ServiceStack.Web.IResponsehttpRes

HasFeature(Feature)

Return whether this App supports this feature

View Source
Declaration
public bool HasFeature(Feature feature)
Returns

System.Boolean

Parameters
TypeName
ServiceStack.Featurefeature

HasPlugin(Type)

Returns true if App has this plugin registered

View Source
Declaration
public bool HasPlugin(Type pluginType)
Returns

System.Boolean

Parameters
TypeName
System.TypepluginType

HasPlugin<T>()

Returns true if App has this plugin registered

View Source
Declaration
public bool HasPlugin<T>()
where T : class, IPlugin
Returns

System.Boolean

Type Parameters
  • T

HasUi()

View Source
Declaration
public virtual bool HasUi()
Returns

System.Boolean

HasValidAuthSecret(IRequest)

Return true if the current request is configured with the super user AdminAuthSecret or not

View Source
Declaration
public bool HasValidAuthSecret(IRequest httpReq)
Returns

System.Boolean

Parameters
TypeName
ServiceStack.Web.IRequesthttpReq

HttpCookieFilter(HttpCookie)

View Source
Declaration
public virtual void HttpCookieFilter(HttpCookie cookie)
Parameters
TypeName
System.Web.HttpCookiecookie

Init()

Initializes the AppHost. Calls the ServiceStack.ServiceStackHost.Configure(Funq.Container) method. Should be called before start.

View Source
Declaration
public virtual ServiceStackHost Init()
Returns

ServiceStack.ServiceStackHost

IsReady()

Whether AppHost is ready configured and either ready to run or already running. Equals ServiceStack.ServiceStackHost.HasStarted

View Source
Declaration
public static bool IsReady()
Returns

System.Boolean

LoadPlugin(IPlugin[])

Manually register Plugin to load

View Source
Declaration
public virtual void LoadPlugin(params IPlugin[] plugins)
Parameters
TypeName
ServiceStack.IPlugin[]plugins

LocalRedirect(IServiceBase, String, String)

View Source
Declaration
public virtual IHttpResult LocalRedirect(IServiceBase service, string redirect, string message)
Returns

ServiceStack.Web.IHttpResult

Parameters
TypeName
ServiceStack.IServiceBaseservice
System.Stringredirect
System.Stringmessage

MapProjectPath(String)

Override to customize the physical path to return for this relativePath

View Source
Declaration
public virtual string MapProjectPath(string relativePath)
Returns

System.String

Parameters
TypeName
System.StringrelativePath

NormalizePathInfo(String, String)

Normalizes /path/info based on Config.HandlerFactoryPath

View Source
Declaration
public static string NormalizePathInfo(string pathInfo, string mode)
Returns

System.String

Parameters
TypeName
System.StringpathInfo
System.Stringmode

OnAfterConfigChanged()

Override to intercept when the Config has changed

View Source
Declaration
public virtual void OnAfterConfigChanged()

OnAfterExecute(IRequest, Object, Object)

Override to intercept the response of a ServiceStack Service request

View Source
Declaration
public virtual object OnAfterExecute(IRequest req, object requestDto, object response)
Returns

System.Object

Parameters
TypeName
ServiceStack.Web.IRequestreq
System.ObjectrequestDto
System.Objectresponse

OnAfterInit()

Override to intercept after the AppHost has been initialized

View Source
Declaration
public virtual void OnAfterInit()

OnApplicationStarted()

View Source
Declaration
public virtual void OnApplicationStarted()

OnApplicationStopping()

View Source
Declaration
public virtual void OnApplicationStopping()

OnBeforeInit()

Override to intercept before the AppHost is initialized

View Source
Declaration
public virtual void OnBeforeInit()

OnConfigLoad()

Override to intercept after the Config was loaded

View Source
Declaration
public virtual void OnConfigLoad()

OnDeserializeJson(Type, Stream)

View Source
Declaration
public virtual object OnDeserializeJson(Type intoType, Stream fromStream)
Returns

System.Object

Parameters
TypeName
System.TypeintoType
System.IO.StreamfromStream

OnEndRequest(IRequest)

Override to intercept the final callback after executing this Request

View Source
Declaration
public virtual void OnEndRequest(IRequest request = null)
Parameters
TypeName
ServiceStack.Web.IRequestrequest

OnExceptionTypeFilter(Exception, ResponseStatus)

Override to intercept & customize Exception responses

View Source
Declaration
public virtual void OnExceptionTypeFilter(Exception ex, ResponseStatus responseStatus)
Parameters
TypeName
System.Exceptionex
ServiceStack.ResponseStatusresponseStatus

OnGatewayException(IRequest, Object, Exception)

Occurs when the Service throws an Service Gateway Exception

View Source
Declaration
public virtual async Task OnGatewayException(IRequest httpReq, object request, Exception ex)
Returns

System.Threading.Tasks.Task

Parameters
TypeName
ServiceStack.Web.IRequesthttpReq
System.Objectrequest
System.Exceptionex

OnLogError(Type, String, Exception)

Callback for handling when errors are logged, also called for non-Exception error logging like 404 requests

View Source
Declaration
public virtual void OnLogError(Type type, string message, Exception innerEx = null)
Parameters
TypeName
System.Typetype
System.Stringmessage
System.ExceptioninnerEx

OnPostExecuteServiceFilter(IService, Object, IRequest, IResponse)

Executed immediately after a service is executed. Use return to change response used.

View Source
Declaration
public virtual object OnPostExecuteServiceFilter(IService service, object response, IRequest httpReq, IResponse httpRes)
Returns

System.Object

Parameters
TypeName
ServiceStack.IServiceservice
System.Objectresponse
ServiceStack.Web.IRequesthttpReq
ServiceStack.Web.IResponsehttpRes

OnPreExecuteServiceFilter(IService, Object, IRequest, IResponse)

Executed immediately before a Service is executed. Use return to change the request DTO used, must be of the same type.

View Source
Declaration
public virtual object OnPreExecuteServiceFilter(IService service, object request, IRequest httpReq, IResponse httpRes)
Returns

System.Object

Parameters
TypeName
ServiceStack.IServiceservice
System.Objectrequest
ServiceStack.Web.IRequesthttpReq
ServiceStack.Web.IResponsehttpRes

OnReady()

View Source
Declaration
protected virtual void OnReady()

OnSaveSession(IRequest, IAuthSession, Nullable<TimeSpan>)

Override to intercept when Sessions using sync APIs are saved

View Source
Declaration
[Obsolete("Use OnSaveSessionAsync")]
public virtual void OnSaveSession(IRequest httpReq, IAuthSession session, TimeSpan? expiresIn = null)
Parameters
TypeName
ServiceStack.Web.IRequesthttpReq
ServiceStack.Auth.IAuthSessionsession
System.Nullable<System.TimeSpan>expiresIn

OnSaveSessionAsync(IRequest, IAuthSession, Nullable<TimeSpan>, CancellationToken)

Override to intercept when Sessions using async APIs are saved

View Source
Declaration
public virtual Task OnSaveSessionAsync(IRequest httpReq, IAuthSession session, TimeSpan? expiresIn = null, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task

Parameters
TypeName
ServiceStack.Web.IRequesthttpReq
ServiceStack.Auth.IAuthSessionsession
System.Nullable<System.TimeSpan>expiresIn
System.Threading.CancellationTokentoken

OnSerializeJson(IRequest, Object, Stream)

View Source
Declaration
public virtual void OnSerializeJson(IRequest req, object dto, Stream outputStream)
Parameters
TypeName
ServiceStack.Web.IRequestreq
System.Objectdto
System.IO.StreamoutputStream

OnServiceException(IRequest, Object, Exception)

Occurs when the Service throws an Exception.

View Source
Declaration
public virtual async Task<object> OnServiceException(IRequest httpReq, object request, Exception ex)
Returns

System.Threading.Tasks.Task<System.Object>

Parameters
TypeName
ServiceStack.Web.IRequesthttpReq
System.Objectrequest
System.Exceptionex

OnSessionFilter(IRequest, IAuthSession, String)

Inspect or modify ever new UserSession created or resolved from cache. return null if Session is invalid to create new Session.

View Source
Declaration
public virtual IAuthSession OnSessionFilter(IRequest req, IAuthSession session, string withSessionId)
Returns

ServiceStack.Auth.IAuthSession

Parameters
TypeName
ServiceStack.Web.IRequestreq
ServiceStack.Auth.IAuthSessionsession
System.StringwithSessionId

OnStartupException(Exception)

Override to intercept Exceptions thrown at Startup. Use StrictMode to rethrow Startup Exceptions

View Source
Declaration
public virtual void OnStartupException(Exception ex)
Parameters
TypeName
System.Exceptionex

OnStartupException(Exception, String, String)

View Source
Declaration
public virtual void OnStartupException(Exception ex, string target, string method)
Parameters
TypeName
System.Exceptionex
System.Stringtarget
System.Stringmethod

OnUncaughtException(IRequest, IResponse, String, Exception)

Occurs when an exception is thrown whilst processing a request.

View Source
Declaration
public virtual async Task OnUncaughtException(IRequest httpReq, IResponse httpRes, string operationName, Exception ex)
Returns

System.Threading.Tasks.Task

Parameters
TypeName
ServiceStack.Web.IRequesthttpReq
ServiceStack.Web.IResponsehttpRes
System.StringoperationName
System.Exceptionex

PopulateArrayFilters()

View Source
Declaration
protected void PopulateArrayFilters()

PostConfigurePlugin<T>(Action<T>)

Register a callback to configure a plugin just after it's registered

View Source
Declaration
public void PostConfigurePlugin<T>(Action<T> configure)
where T : class, IPlugin
Parameters
TypeName
System.Action<<T>>configure
Type Parameters
  • T

PublishMessage<T>(IMessageProducer, T)

Override to intercept MQ Publish Requests

View Source
Declaration
public virtual void PublishMessage<T>(IMessageProducer messageProducer, T message)
Parameters
TypeName
ServiceStack.Messaging.IMessageProducermessageProducer
<T>message
Type Parameters
  • T

Redirect(IServiceBase, String, String)

View Source
Declaration
public virtual IHttpResult Redirect(IServiceBase service, string redirect, string message)
Returns

ServiceStack.Web.IHttpResult

Parameters
TypeName
ServiceStack.IServiceBaseservice
System.Stringredirect
System.Stringmessage

Register<T>(T)

Register singleton in the Ioc Container of the AppHost.

View Source
Declaration
public virtual void Register<T>(T instance)
Parameters
TypeName
<T>instance
Type Parameters
  • T

RegisterAs<T, TAs>()

Registers type to be automatically wired by the Ioc container of the AppHost.

View Source
Declaration
public virtual void RegisterAs<T, TAs>()
where T : TAs
Type Parameters
NameDescription
TConcrete type
TAsAbstract type

RegisterLicenseKey(String)

View Source
Declaration
protected virtual void RegisterLicenseKey(string licenseKeyText)
Parameters
TypeName
System.StringlicenseKeyText

RegisterService(Type, String[])

Manually register ServiceStack Service at these routes

View Source
Declaration
public virtual void RegisterService(Type serviceType, params string[] atRestPaths)
Parameters
TypeName
System.TypeserviceType
System.String[]atRestPaths

RegisterService<T>(String[])

Manually register ServiceStack Service at these routes

View Source
Declaration
public virtual void RegisterService<T>(params string[] atRestPaths)
where T : IService
Parameters
TypeName
System.String[]atRestPaths
Type Parameters
  • T

RegisterServicesInAssembly(Assembly)

Register all ServiceStack Services found in this Assembly

View Source
Declaration
public void RegisterServicesInAssembly(Assembly assembly)
Parameters
TypeName
System.Reflection.Assemblyassembly

RegisterTypedMessageRequestFilter<T>(Action<IRequest, IResponse, T>)

Register Typed MQ Request Filter

View Source
Declaration
public void RegisterTypedMessageRequestFilter<T>(Action<IRequest, IResponse, T> filterFn)
Parameters
TypeName
System.Action<ServiceStack.Web.IRequest,ServiceStack.Web.IResponse,<T>>filterFn
Type Parameters
  • T

RegisterTypedMessageResponseFilter<T>(Action<IRequest, IResponse, T>)

Register Typed MQ Response Filter

View Source
Declaration
public void RegisterTypedMessageResponseFilter<T>(Action<IRequest, IResponse, T> filterFn)
Parameters
TypeName
System.Action<ServiceStack.Web.IRequest,ServiceStack.Web.IResponse,<T>>filterFn
Type Parameters
  • T

RegisterTypedRequestFilter<T>(Action<IRequest, IResponse, T>)

Register Typed Service Request Filter

View Source
Declaration
public void RegisterTypedRequestFilter<T>(Action<IRequest, IResponse, T> filterFn)
Parameters
TypeName
System.Action<ServiceStack.Web.IRequest,ServiceStack.Web.IResponse,<T>>filterFn
Type Parameters
  • T

RegisterTypedRequestFilter<T>(Func<Container, ITypedFilter<T>>)

Register Typed Service Request Filter

View Source
Declaration
public void RegisterTypedRequestFilter<T>(Func<Container, ITypedFilter<T>> filter)
Parameters
TypeName
System.Func<Funq.Container,ServiceStack.Host.ITypedFilter<<T>>>filter
Type Parameters
  • T

RegisterTypedRequestFilterAsync<T>(Func<Container, ITypedFilterAsync<T>>)

Register Async Typed Service Request Filter

View Source
Declaration
public void RegisterTypedRequestFilterAsync<T>(Func<Container, ITypedFilterAsync<T>> filter)
Parameters
TypeName
System.Func<Funq.Container,ServiceStack.Host.ITypedFilterAsync<<T>>>filter
Type Parameters
  • T

RegisterTypedRequestFilterAsync<T>(Func<IRequest, IResponse, T, Task>)

Register Async Typed Service Request Filter

View Source
Declaration
public void RegisterTypedRequestFilterAsync<T>(Func<IRequest, IResponse, T, Task> filterFn)
Parameters
TypeName
System.Func<ServiceStack.Web.IRequest,ServiceStack.Web.IResponse,<T>,System.Threading.Tasks.Task>filterFn
Type Parameters
  • T

RegisterTypedResponseFilter<T>(Action<IRequest, IResponse, T>)

Register Typed Service Response Filter

View Source
Declaration
public void RegisterTypedResponseFilter<T>(Action<IRequest, IResponse, T> filterFn)
Parameters
TypeName
System.Action<ServiceStack.Web.IRequest,ServiceStack.Web.IResponse,<T>>filterFn
Type Parameters
  • T

RegisterTypedResponseFilter<T>(Func<Container, ITypedFilter<T>>)

Register Typed Service Response Filter

View Source
Declaration
public void RegisterTypedResponseFilter<T>(Func<Container, ITypedFilter<T>> filter)
Parameters
TypeName
System.Func<Funq.Container,ServiceStack.Host.ITypedFilter<<T>>>filter
Type Parameters
  • T

RegisterTypedResponseFilterAsync<T>(Func<Container, ITypedFilterAsync<T>>)

Register Async Typed Service Response Filter

View Source
Declaration
public void RegisterTypedResponseFilterAsync<T>(Func<Container, ITypedFilterAsync<T>> filter)
Parameters
TypeName
System.Func<Funq.Container,ServiceStack.Host.ITypedFilterAsync<<T>>>filter
Type Parameters
  • T

RegisterTypedResponseFilterAsync<T>(Func<IRequest, IResponse, T, Task>)

Register Async Typed Service Response Filter

View Source
Declaration
public void RegisterTypedResponseFilterAsync<T>(Func<IRequest, IResponse, T, Task> filterFn)
Parameters
TypeName
System.Func<ServiceStack.Web.IRequest,ServiceStack.Web.IResponse,<T>,System.Threading.Tasks.Task>filterFn
Type Parameters
  • T

Release(Object)

Override to intercept releasing this Service or Attribute instance

View Source
Declaration
public virtual void Release(object instance)
Parameters
TypeName
System.Objectinstance

Resolve<T>()

Resolves Type through the Ioc container of the AppHost.

View Source
Declaration
public virtual T Resolve<T>()
Returns

<T>

Type Parameters
  • T

ResolveAbsoluteUrl(String, IRequest)

Override to customize the Absolute URL for this virtualPath for this IRequest

View Source
Declaration
public virtual string ResolveAbsoluteUrl(string virtualPath, IRequest httpReq)
Returns

System.String

Parameters
TypeName
System.StringvirtualPath
ServiceStack.Web.IRequesthttpReq

ResolveLocalizedString(String, IRequest)

Override to use a localized string for internal routes & text used by ServiceStack

View Source
Declaration
public virtual string ResolveLocalizedString(string text, IRequest request = null)
Returns

System.String

Parameters
TypeName
System.Stringtext
ServiceStack.Web.IRequestrequest

ResolveLocalizedStringFormat(String, Object[], IRequest)

Override to use a localized string for internal routes & text used by ServiceStack

View Source
Declaration
public virtual string ResolveLocalizedStringFormat(string text, object[] args, IRequest request = null)
Returns

System.String

Parameters
TypeName
System.Stringtext
System.Object[]args
ServiceStack.Web.IRequestrequest

ResolvePathInfo(IRequest, String)

Override to customize normalized /path/info to use for this request

View Source
Declaration
public virtual string ResolvePathInfo(IRequest request, string originalPathInfo)
Returns

System.String

Parameters
TypeName
ServiceStack.Web.IRequestrequest
System.StringoriginalPathInfo

ResolvePhysicalPath(String, IRequest)

Override to customize the Physical Path for this virtualPath for this IRequest

View Source
Declaration
public virtual string ResolvePhysicalPath(string virtualPath, IRequest httpReq)
Returns

System.String

Parameters
TypeName
System.StringvirtualPath
ServiceStack.Web.IRequesthttpReq

ReturnRedirectHandler(IHttpRequest)

Override to customize Redirect Responses

View Source
Declaration
public virtual IHttpHandler ReturnRedirectHandler(IHttpRequest httpReq)
Returns

System.Web.IHttpHandler

Parameters
TypeName
ServiceStack.Web.IHttpRequesthttpReq

ReturnRequestInfoHandler(IHttpRequest)

Override to customize IHttpHandler used to service ?debug=requestinfo requests

View Source
Declaration
public virtual IHttpHandler ReturnRequestInfoHandler(IHttpRequest httpReq)
Returns

System.Web.IHttpHandler

Parameters
TypeName
ServiceStack.Web.IHttpRequesthttpReq

SetConfig(HostConfig)

Set the host config of the AppHost.

View Source
Declaration
public virtual void SetConfig(HostConfig config)
Parameters
TypeName
ServiceStack.HostConfigconfig

Override built-in Cookies, return false to prevent the Cookie from being set.

View Source
Declaration
public virtual bool SetCookieFilter(IRequest req, Cookie cookie)
Returns

System.Boolean

Parameters
TypeName
ServiceStack.Web.IRequestreq
System.Net.Cookiecookie

ShouldCompressFile(IVirtualFile)

Override to return whether static files should be sent compressed or not (if supported by UserAgent)

View Source
Declaration
public virtual bool ShouldCompressFile(IVirtualFile file)
Returns

System.Boolean

Parameters
TypeName
ServiceStack.IO.IVirtualFilefile

ShouldProfileRequest(IRequest)

View Source
Declaration
public virtual bool ShouldProfileRequest(IRequest req)
Returns

System.Boolean

Parameters
TypeName
ServiceStack.Web.IRequestreq

Start(String)

Starts the AppHost. this methods needs to be overwritten in subclass to provider a listener to start handling requests.

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

ServiceStack.ServiceStackHost

Parameters
TypeNameDescription
System.StringurlBaseUrl to listen to

|

TryGetCurrentRequest()

Overriden by AppHost's to return the current IRequest if it supports singleton access to the Request Context

View Source
Declaration
public virtual IRequest TryGetCurrentRequest()
Returns

ServiceStack.Web.IRequest

TryGetNativeCacheClient(IRequest, out ICacheClient, out ICacheClientAsync)

Only sets cacheAsync if native Async provider, otherwise sets cacheSync

View Source
Declaration
public virtual void TryGetNativeCacheClient(IRequest req, out ICacheClient cacheSync, out ICacheClientAsync cacheAsync)
Parameters
TypeName
ServiceStack.Web.IRequestreq
ServiceStack.Caching.ICacheClientcacheSync
ServiceStack.Caching.ICacheClientAsynccacheAsync

TryGetUserId(IRequest)

Try infer UserId from IRequest

View Source
Declaration
public virtual string TryGetUserId(IRequest req)
Returns

System.String

Parameters
TypeName
ServiceStack.Web.IRequestreq

TryResolve<T>()

Tries to resolve type through the ioc container of the AppHost. Can return null.

View Source
Declaration
public virtual T TryResolve<T>()
Returns

<T>

Type Parameters
  • T

UseException(Exception)

Return the Exception to use when creating the Error Response DTO and ResponseStatus

View Source
Declaration
public Exception UseException(Exception ex)
Returns

System.Exception

Parameters
TypeName
System.Exceptionex

UseHttps(IRequest)

Override to change whether absolute links should use https:// URLs

View Source
Declaration
public virtual bool UseHttps(IRequest httpReq)
Returns

System.Boolean

Parameters
TypeName
ServiceStack.Web.IRequesthttpReq

WriteAutoHtmlResponseAsync(IRequest, Object, String, Stream)

Override to intercept auto HTML Page Response

View Source
Declaration
public virtual async Task WriteAutoHtmlResponseAsync(IRequest request, object response, string html, Stream outputStream)
Returns

System.Threading.Tasks.Task

Parameters
TypeName
ServiceStack.Web.IRequestrequest
System.Objectresponse
System.Stringhtml
System.IO.StreamoutputStream

WriteSoapMessage(IRequest, Message, Stream)

View Source
Declaration
public virtual void WriteSoapMessage(IRequest req, Message message, Stream outputStream)
Parameters
TypeName
ServiceStack.Web.IRequestreq
System.ServiceModel.Channels.Messagemessage
System.IO.StreamoutputStream

Implements