GenericAppHost
Assembly: ServiceStack.dll
View Source
public class GenericAppHost : ServiceStackHost, IAppHost, IResolver, IFunqlet, IHasContainer, IDisposable
Properties
ConfigureContainer
View Source
public Action<Container> ConfigureContainer { get; set; }
ConfigureAppHost
View Source
public Action<GenericAppHost> ConfigureAppHost { get; set; }
ConfigFilter
View Source
public Action<HostConfig> ConfigFilter { get; set; }
Inherited Properties
AddVirtualFileSources
Append lower priority VFS providers at the end of the VFS providers list
View Source
public List<IVirtualPathProvider> AddVirtualFileSources { get; set; }
AfterConfigure
Register callbacks fired just after AppHost.Configure()
View Source
public List<Action<ServiceStackHost>> AfterConfigure { get; set; }
AfterInitAt
When the Init function was done. Called at begin of ServiceStack.ServiceStackHost.OnAfterInit()
View Source
public DateTime? AfterInitAt { get; set; }
AfterInitCallbacks
Register callbacks that's fired after the AppHost is initialized
View Source
public List<Action<IAppHost>> AfterInitCallbacks { get; set; }
AfterPluginsLoaded
Register callbacks fired just after plugins are loaded
View Source
public List<Action<ServiceStackHost>> AfterPluginsLoaded { get; set; }
AppName
Sharp App Name
View Source
public string AppName { get; set; }
AppSettings
ServiceStack's Configuration API, see: https://docs.servicestack.net/appsettings
View Source
public IAppSettings AppSettings { get; set; }
AsyncErrors
Captured Unobserved Async Errors
View Source
public List<ResponseStatus> AsyncErrors { get; set; }
BeforeConfigure
Register callbacks fired just before AppHost.Configure()
View Source
public List<Action<ServiceStackHost>> BeforeConfigure { get; set; }
CatchAllHandlers
Get "Catch All" IHttpHandler predicate IHttpHandler's, e.g. Used by HTML View Engines
View Source
public List<HttpHandlerResolverDelegate> CatchAllHandlers { get; set; }
Config
The Configuration for this AppHost
View Source
public HostConfig Config { get; set; }
Container
The AppHost.Container. Note: it is not thread safe to register dependencies after AppStart.
View Source
public virtual Container Container { get; }
ContentRootDirectory
The Content Root Directory for this AppHost
View Source
public IVirtualDirectory ContentRootDirectory { get; }
ContentTypes
Manage registered Content Types & their sync/async serializers supported by this AppHost
View Source
public IContentTypes ContentTypes { get; set; }
CustomErrorHttpHandlers
Register Custom IServiceStackHandler to handle specific HttpStatusCode's
View Source
public Dictionary<HttpStatusCode, IServiceStackHandler> CustomErrorHttpHandlers { get; set; }
DefaultScriptContext
The fallback ScriptContext to use if no SharpPagesFeature plugin was registered
View Source
public ScriptContext DefaultScriptContext { get; set; }
ExcludeAutoRegisteringServiceTypes
View Source
public HashSet<Type> ExcludeAutoRegisteringServiceTypes { get; set; }
FallbackHandlers
Register fallback Request Handlers e.g. Used by #Script & Razor Page Based Routing
View Source
public List<HttpHandlerResolverDelegate> FallbackHandlers { get; set; }
GatewayExceptionHandlers
View Source
public List<HandleGatewayExceptionDelegate> GatewayExceptionHandlers { get; set; }
GatewayExceptionHandlersAsync
View Source
public List<HandleGatewayExceptionAsyncDelegate> GatewayExceptionHandlersAsync { get; set; }
GatewayRequestFilters
View Source
public List<Action<IRequest, object>> GatewayRequestFilters { get; set; }
GatewayRequestFiltersAsync
View Source
public List<Func<IRequest, object, Task>> GatewayRequestFiltersAsync { get; set; }
GatewayResponseFilters
View Source
public List<Action<IRequest, object>> GatewayResponseFilters { get; set; }
GatewayResponseFiltersAsync
View Source
public List<Func<IRequest, object, Task>> GatewayResponseFiltersAsync { get; set; }
GlobalAfterAppHostInit
Register static callbacks fired after the AppHost is initialized
View Source
public static List<Action<ServiceStackHost>> GlobalAfterAppHostInit { get; }
GlobalAfterConfigure
Register static callbacks fired just after AppHost.Configure()
View Source
public static List<Action<ServiceStackHost>> GlobalAfterConfigure { get; }
GlobalAfterPluginsLoaded
Register static callbacks fired just after plugins are loaded
View Source
public static List<Action<ServiceStackHost>> GlobalAfterPluginsLoaded { get; }
GlobalBeforeConfigure
Register static callbacks fired just before AppHost.Configure()
View Source
public static List<Action<ServiceStackHost>> GlobalBeforeConfigure { get; }
GlobalHtmlErrorHttpHandler
Fallback IServiceStackHandler to handle Error Responses
View Source
public IServiceStackHandler GlobalHtmlErrorHttpHandler { get; set; }
GlobalMessageRequestFilters
View Source
public List<Action<IRequest, IResponse, object>> GlobalMessageRequestFilters { get; }
GlobalMessageRequestFiltersAsync
View Source
public List<Func<IRequest, IResponse, object, Task>> GlobalMessageRequestFiltersAsync { get; }
GlobalMessageResponseFilters
View Source
public List<Action<IRequest, IResponse, object>> GlobalMessageResponseFilters { get; }
GlobalMessageResponseFiltersAsync
View Source
public List<Func<IRequest, IResponse, object, Task>> GlobalMessageResponseFiltersAsync { get; }
GlobalRequestFilters
View Source
public List<Action<IRequest, IResponse, object>> GlobalRequestFilters { get; set; }
GlobalRequestFiltersAsync
View Source
public List<Func<IRequest, IResponse, object, Task>> GlobalRequestFiltersAsync { get; set; }
GlobalResponseFilters
View Source
public List<Action<IRequest, IResponse, object>> GlobalResponseFilters { get; set; }
GlobalResponseFiltersAsync
View Source
public List<Func<IRequest, IResponse, object, Task>> GlobalResponseFiltersAsync { get; set; }
GlobalTypedMessageRequestFilters
View Source
public Dictionary<Type, ITypedFilter> GlobalTypedMessageRequestFilters { get; set; }
GlobalTypedMessageResponseFilters
View Source
public Dictionary<Type, ITypedFilter> GlobalTypedMessageResponseFilters { get; set; }
GlobalTypedRequestFilters
View Source
public Dictionary<Type, ITypedFilter> GlobalTypedRequestFilters { get; set; }
GlobalTypedRequestFiltersAsync
View Source
public Dictionary<Type, ITypedFilterAsync> GlobalTypedRequestFiltersAsync { get; set; }
GlobalTypedResponseFilters
View Source
public Dictionary<Type, ITypedFilter> GlobalTypedResponseFilters { get; set; }
GlobalTypedResponseFiltersAsync
View Source
public Dictionary<Type, ITypedFilterAsync> GlobalTypedResponseFiltersAsync { get; set; }
HasInit
Whether AppHost has been already initialized
View Source
public static bool HasInit { get; }
HasStarted
Whether AppHost configuration is done. Note: It doesn't mean the start function was called.
View Source
public bool HasStarted { get; }
InsertVirtualFileSources
Insert higher priority VFS providers at the start of the VFS providers list
View Source
public List<IVirtualPathProvider> InsertVirtualFileSources { get; set; }
Instance
Singleton access to AppHost
View Source
public static ServiceStackHost Instance { get; protected set; }
IsDebugLogEnabled
View Source
public bool IsDebugLogEnabled { get; }
Metadata
The populated Metadata for this AppHost's Services
View Source
public ServiceMetadata Metadata { get; set; }
MetadataPagesConfig
Configuration of ServiceStack's /metadata pages
View Source
public MetadataPagesConfig MetadataPagesConfig { get; }
OnAfterPluginsLoaded
View Source
public Dictionary<Type, List<Action<IPlugin>>> OnAfterPluginsLoaded { get; set; }
OnDisposeCallbacks
Register callbacks that's fired when AppHost is disposed
View Source
public List<Action<IAppHost>> OnDisposeCallbacks { get; set; }
OnEndRequestCallbacks
Register callbacks to execute at the end of a Request
View Source
public List<Action<IRequest>> OnEndRequestCallbacks { get; set; }
OnPostRegisterPlugins
View Source
public Dictionary<Type, List<Action<IPlugin>>> OnPostRegisterPlugins { get; set; }
OnPreRegisterPlugins
View Source
public Dictionary<Type, List<Action<IPlugin>>> OnPreRegisterPlugins { get; set; }
PathBase
The base path ServiceStack is hosted on
View Source
public virtual string PathBase { get; set; }
Plugins
Collection of added plugins.
View Source
public List<IPlugin> Plugins { get; set; }
PluginsLoaded
Which plugins were loaded in this AppHost
View Source
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
public List<Action<IRequest, IResponse>> PreRequestFilters { get; set; }
RawHttpHandlers
Register highest priority IHttpHandler callbacks
View Source
public List<Func<IHttpRequest, IHttpHandler>> RawHttpHandlers { get; set; }
ReadyAt
When all configuration was completed. Called at the end of ServiceStack.ServiceStackHost.OnAfterInit()
View Source
public DateTime? ReadyAt { get; set; }
RequestBinders
Register custom Request Binder
View Source
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
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
public List<Func<IRequest, object, Task<object>>> ResponseConverters { get; set; }
RestPaths
Registered Routes
View Source
public List<RestPath> RestPaths { get; set; }
RootDirectory
FileSystem VFS for WebRoot
View Source
public IVirtualDirectory RootDirectory { get; }
Routes
Dynamically register Service Routes
View Source
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
public RpcGateway RpcGateway { get; set; }
ScriptContext
Global #Script ScriptContext for AppHost. Returns SharpPagesFeature plugin or fallsback to DefaultScriptContext.
View Source
public ScriptContext ScriptContext { get; }
ServiceAssemblies
The assemblies reflected to find api services. These can be provided in the constructor call.
View Source
public List<Assembly> ServiceAssemblies { get; }
ServiceController
The ServiceController that executes Services
View Source
public ServiceController ServiceController { get; set; }
ServiceExceptionHandlers
View Source
public List<HandleServiceExceptionDelegate> ServiceExceptionHandlers { get; set; }
ServiceExceptionHandlersAsync
View Source
public List<HandleServiceExceptionAsyncDelegate> ServiceExceptionHandlersAsync { get; set; }
ServiceName
The public name of this App
View Source
public string ServiceName { get; set; }
StartedAt
When the AppHost was instantiated.
View Source
public DateTime StartedAt { get; set; }
StartUpErrors
Captured StartUp Exceptions
View Source
public List<ResponseStatus> StartUpErrors { get; set; }
TestMode
If app currently runs for unit tests. Used for overwriting AuthSession.
View Source
public bool TestMode { get; set; }
UncaughtExceptionHandlers
View Source
public List<HandleUncaughtExceptionDelegate> UncaughtExceptionHandlers { get; set; }
UncaughtExceptionHandlersAsync
View Source
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
public List<IViewEngine> ViewEngines { get; set; }
VirtualFiles
Writable Virtual File Source, uses FileSystemVirtualFiles at content root by default
View Source
public IVirtualFiles VirtualFiles { get; set; }
VirtualFileSources
Virtual File Sources from WebRoot, typically a MultiVirtualFiles containing a cascading list of Sources
View Source
public IVirtualPathProvider VirtualFileSources { get; set; }
Methods
Configure(Container)
View Source
public override void Configure(Container container)
Parameters
Type | Name |
---|---|
Funq.Container | container |
GetServiceGateway(IRequest)
View Source
public override IServiceGateway GetServiceGateway(IRequest req)
Returns
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
OnConfigLoad()
View Source
public override void OnConfigLoad()
Inherited Methods
AfterPluginLoaded<T>(Action<T>)
Register a callback to configure a plugin after AfterPluginsLoaded is run
View Source
public void AfterPluginLoaded<T>(Action<T> configure)
where T : class, IPlugin
Parameters
Type | Name |
---|---|
System.Action<<T>> | configure |
Type Parameters
T
AllowSetCookie(IRequest, String)
View Source
[Obsolete("Override SetCookieFilter")]
protected virtual bool AllowSetCookie(IRequest req, string cookieName)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
System.String | cookieName |
ApplyCustomHandlerRequestFilters(IRequest, IResponse)
Apply PreRequest Filters for participating Custom Handlers, e.g. RazorFormat, MarkdownFormat, etc
View Source
public bool ApplyCustomHandlerRequestFilters(IRequest httpReq, IResponse httpRes)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | httpReq |
ServiceStack.Web.IResponse | httpRes |
ApplyGatewayRequestFiltersAsync(IRequest, Object)
Execute Service Gateway Request Filters
View Source
public async Task<bool> ApplyGatewayRequestFiltersAsync(IRequest req, object request)
Returns
System.Threading.Tasks.Task<System.Boolean>
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
System.Object | request |
ApplyGatewayRespoonseFiltersAsync(IRequest, Object)
Execute Service Gateway Response Filters
View Source
public async Task<bool> ApplyGatewayRespoonseFiltersAsync(IRequest req, object responseDto)
Returns
System.Threading.Tasks.Task<System.Boolean>
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
System.Object | responseDto |
ApplyMessageRequestFilters(IRequest, IResponse, Object)
Executes MQ Response Filters
View Source
public bool ApplyMessageRequestFilters(IRequest req, IResponse res, object requestDto)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
ServiceStack.Web.IResponse | res |
System.Object | requestDto |
ApplyMessageResponseFilters(IRequest, IResponse, Object)
Executes MQ Response Filters
View Source
public bool ApplyMessageResponseFilters(IRequest req, IResponse res, object response)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
ServiceStack.Web.IResponse | res |
System.Object | response |
ApplyPreAuthenticateFiltersAsync(IRequest, IResponse)
Apply PreAuthenticate Filters from IAuthWithRequest AuthProviders
View Source
public virtual async Task ApplyPreAuthenticateFiltersAsync(IRequest httpReq, IResponse httpRes)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | httpReq |
ServiceStack.Web.IResponse | httpRes |
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
public bool ApplyPreRequestFilters(IRequest httpReq, IResponse httpRes)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | httpReq |
ServiceStack.Web.IResponse | httpRes |
ApplyRequestConvertersAsync(IRequest, Object)
Executes Service Request Converters
View Source
public async Task<object> ApplyRequestConvertersAsync(IRequest req, object requestDto)
Returns
System.Threading.Tasks.Task<System.Object>
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
System.Object | requestDto |
ApplyRequestFilters(IRequest, IResponse, Object)
View Source
[Obsolete("Use ApplyRequestFiltersAsync")]
public bool ApplyRequestFilters(IRequest req, IResponse res, object requestDto)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
ServiceStack.Web.IResponse | res |
System.Object | requestDto |
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
public async Task ApplyRequestFiltersAsync(IRequest req, IResponse res, object requestDto)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
ServiceStack.Web.IResponse | res |
System.Object | requestDto |
ApplyRequestFiltersSingleAsync(IRequest, IResponse, Object)
Executes Service Request Filters
View Source
protected async Task ApplyRequestFiltersSingleAsync(IRequest req, IResponse res, object requestDto)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
ServiceStack.Web.IResponse | res |
System.Object | requestDto |
ApplyResponseConvertersAsync(IRequest, Object)
Executes Service Response Converters
View Source
public async Task<object> ApplyResponseConvertersAsync(IRequest req, object responseDto)
Returns
System.Threading.Tasks.Task<System.Object>
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
System.Object | responseDto |
ApplyResponseFilters(IRequest, IResponse, Object)
View Source
[Obsolete("Use ApplyResponseFiltersAsync")]
public bool ApplyResponseFilters(IRequest req, IResponse res, object response)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
ServiceStack.Web.IResponse | res |
System.Object | response |
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
public async Task ApplyResponseFiltersAsync(IRequest req, IResponse res, object response)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
ServiceStack.Web.IResponse | res |
System.Object | response |
ApplyResponseFiltersSingleAsync(IRequest, IResponse, Object)
Executes Service Response Filters
View Source
protected async Task ApplyResponseFiltersSingleAsync(IRequest req, IResponse res, object response)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
ServiceStack.Web.IResponse | res |
System.Object | response |
AssertAuthenticated(IAuthSession, IRequest)
Default logic to determine whether a Session is Authenticated
View Source
public virtual IAuthSession AssertAuthenticated(IAuthSession session, IRequest req = null)
Returns
ServiceStack.Auth.IAuthSession
Parameters
Type | Name |
---|---|
ServiceStack.Auth.IAuthSession | session |
ServiceStack.Web.IRequest | req |
AssertContentType(String)
Assert whether this App should server this contentType
View Source
public void AssertContentType(string contentType)
Parameters
Type | Name |
---|---|
System.String | contentType |
AssertFeatures(Feature)
Assert whether this App supports this feature
View Source
public void AssertFeatures(Feature usesFeatures)
Parameters
Type | Name |
---|---|
ServiceStack.Feature | usesFeatures |
AuthenticationRequired(IServiceBase)
View Source
public virtual IHttpResult AuthenticationRequired(IServiceBase service)
Returns
Parameters
Type | Name |
---|---|
ServiceStack.IServiceBase | service |
Configure(Container)
Configure your AppHost and its dependencies
View Source
public abstract void Configure(Container container)
Parameters
Type | Name |
---|---|
Funq.Container | container |
ConfigureLogging()
View Source
public virtual void ConfigureLogging()
ConfigurePlugin<T>(Action<T>)
Register a callback to configure a plugin just before it's registered
View Source
public void ConfigurePlugin<T>(Action<T> configure)
where T : class, IPlugin
Parameters
Type | Name |
---|---|
System.Action<<T>> | configure |
Type Parameters
T
CreateErrorResponse(Exception, Object)
Override to customize converting an Exception into a generic ErrorResponse DTO
View Source
public virtual ErrorResponse CreateErrorResponse(Exception ex, object request = null)
Returns
Parameters
Type | Name |
---|---|
System.Exception | ex |
System.Object | request |
CreateResponseStatus(Exception, Object)
Override to customize converting an Exception into the ResponseStatus DTO
View Source
public virtual ResponseStatus CreateResponseStatus(Exception ex, object request = null)
Returns
Parameters
Type | Name |
---|---|
System.Exception | ex |
System.Object | request |
CreateServiceController(Assembly[])
View Source
protected virtual ServiceController CreateServiceController(params Assembly[] assembliesWithServices)
Returns
ServiceStack.Host.ServiceController
Parameters
Type | Name |
---|---|
System.Reflection.Assembly[] | assembliesWithServices |
CreateServiceController(Type[])
View Source
protected virtual ServiceController CreateServiceController(params Type[] serviceTypes)
Returns
ServiceStack.Host.ServiceController
Parameters
Type | Name |
---|---|
System.Type[] | serviceTypes |
CreateServiceRunner<TRequest>(ActionContext)
Override to use a Custom ServiceRunner to execute this Request DTO
View Source
public virtual IServiceRunner<TRequest> CreateServiceRunner<TRequest>(ActionContext actionContext)
Returns
ServiceStack.Web.IServiceRunner<TRequest>
Parameters
Type | Name |
---|---|
ServiceStack.Host.ActionContext | actionContext |
Type Parameters
TRequest
Dispose()
View Source
public void Dispose()
Dispose(Boolean)
Executes OnDisposeCallbacks and Disposes IDisposable's dependencies in the IOC & reset singleton states
View Source
protected virtual void Dispose(bool disposing)
Parameters
Type | Name |
---|---|
System.Boolean | disposing |
EvalExpression(String)
View Source
public virtual object EvalExpression(string expr)
Returns
System.Object
Parameters
Type | Name |
---|---|
System.String | expr |
EvalExpressionCached(String)
Evaluate Expressions in ServiceStack's ScriptContext. Can be overridden if you want to customize how different expressions are evaluated.
View Source
public virtual object EvalExpressionCached(string expr)
Returns
System.Object
Parameters
Type | Name |
---|---|
System.String | expr |
EvalScript(PageResult, IRequest, Dictionary<String, Object>)
Override to intercept sync #Script execution
View Source
public virtual object EvalScript(PageResult pageResult, IRequest req = null, Dictionary<string, object> args = null)
Returns
System.Object
Parameters
Type | Name |
---|---|
ServiceStack.Script.PageResult | pageResult |
ServiceStack.Web.IRequest | req |
System.Collections.Generic.Dictionary<System.String,System.Object> | args |
EvalScriptAsync(PageResult, IRequest, Dictionary<String, Object>)
Override to intercept async #Script execution
View Source
public virtual async Task<object> EvalScriptAsync(PageResult pageResult, IRequest req = null, Dictionary<string, object> args = null)
Returns
System.Threading.Tasks.Task<System.Object>
Parameters
Type | Name |
---|---|
ServiceStack.Script.PageResult | pageResult |
ServiceStack.Web.IRequest | req |
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
public virtual object EvalScriptValue(IScriptValue scriptValue, IRequest req = null, Dictionary<string, object> args = null)
Returns
System.Object
Parameters
Type | Name |
---|---|
ServiceStack.IScriptValue | scriptValue |
ServiceStack.Web.IRequest | req |
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
public virtual async Task<object> EvalScriptValueAsync(IScriptValue scriptValue, IRequest req = null, Dictionary<string, object> args = null)
Returns
System.Threading.Tasks.Task<System.Object>
Parameters
Type | Name |
---|---|
ServiceStack.IScriptValue | scriptValue |
ServiceStack.Web.IRequest | req |
System.Collections.Generic.Dictionary<System.String,System.Object> | args |
ExecTypedFilters(Dictionary<Type, ITypedFilter>, IRequest, IResponse, Object)
Executes Typed Request Filters
View Source
public void ExecTypedFilters(Dictionary<Type, ITypedFilter> typedFilters, IRequest req, IResponse res, object dto)
Parameters
Type | Name |
---|---|
System.Collections.Generic.Dictionary<System.Type,ServiceStack.Host.ITypedFilter> | typedFilters |
ServiceStack.Web.IRequest | req |
ServiceStack.Web.IResponse | res |
System.Object | dto |
ExecTypedFiltersAsync(Dictionary<Type, ITypedFilterAsync>, IRequest, IResponse, Object)
Executes Typed Request Filters
View Source
public async Task ExecTypedFiltersAsync(Dictionary<Type, ITypedFilterAsync> typedFilters, IRequest req, IResponse res, object dto)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
System.Collections.Generic.Dictionary<System.Type,ServiceStack.Host.ITypedFilterAsync> | typedFilters |
ServiceStack.Web.IRequest | req |
ServiceStack.Web.IResponse | res |
System.Object | dto |
ExecuteMessage(IMessage)
Override to intercept MQ Requests
View Source
public virtual object ExecuteMessage(IMessage mqMessage)
Returns
System.Object
Parameters
Type | Name |
---|---|
ServiceStack.Messaging.IMessage | mqMessage |
ExecuteMessage(IMessage, IRequest)
Override to intercept MQ Requests
View Source
public virtual object ExecuteMessage(IMessage dto, IRequest req)
Returns
System.Object
Parameters
Type | Name |
---|---|
ServiceStack.Messaging.IMessage | dto |
ServiceStack.Web.IRequest | req |
ExecuteMessageAsync(IMessage, IRequest, CancellationToken)
Override to intercept MQ Requests
View Source
public Task<object> ExecuteMessageAsync(IMessage mqMessage, IRequest req, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.Object>
Parameters
Type | Name |
---|---|
ServiceStack.Messaging.IMessage | mqMessage |
ServiceStack.Web.IRequest | req |
System.Threading.CancellationToken | token |
ExecuteMessageAsync(IMessage, CancellationToken)
Override to intercept MQ Requests
View Source
public Task<object> ExecuteMessageAsync(IMessage mqMessage, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.Object>
Parameters
Type | Name |
---|---|
ServiceStack.Messaging.IMessage | mqMessage |
System.Threading.CancellationToken | token |
ExecuteService(Object)
Override to intercept Service Requests
View Source
public virtual object ExecuteService(object requestDto)
Returns
System.Object
Parameters
Type | Name |
---|---|
System.Object | requestDto |
ExecuteService(Object, RequestAttributes)
Override to intercept Service Requests
View Source
public virtual object ExecuteService(object requestDto, RequestAttributes requestAttributes)
Returns
System.Object
Parameters
Type | Name |
---|---|
System.Object | requestDto |
ServiceStack.RequestAttributes | requestAttributes |
ExecuteService(Object, IRequest)
Override to intercept Service Requests
View Source
public virtual object ExecuteService(object requestDto, IRequest req)
Returns
System.Object
Parameters
Type | Name |
---|---|
System.Object | requestDto |
ServiceStack.Web.IRequest | req |
ExecuteServiceAsync(Object, IRequest)
Override to intercept Async Service Requests
View Source
public virtual Task<object> ExecuteServiceAsync(object requestDto, IRequest req)
Returns
System.Threading.Tasks.Task<System.Object>
Parameters
Type | Name |
---|---|
System.Object | requestDto |
ServiceStack.Web.IRequest | req |
ExportSoapOperationTypes(List<Type>)
View Source
public virtual List<Type> ExportSoapOperationTypes(List<Type> operationTypes)
Returns
System.Collections.Generic.List<System.Type>
Parameters
Type | Name |
---|---|
System.Collections.Generic.List<System.Type> | operationTypes |
ExportSoapType(Type)
View Source
public virtual bool ExportSoapType(Type type)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.Type | type |
Finalize()
View Source
protected void Finalize()
GenerateWsdl(WsdlTemplateBase)
Override to customize WSDL returned in SOAP /metadata pages
View Source
public virtual string GenerateWsdl(WsdlTemplateBase wsdlTemplate)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.Metadata.WsdlTemplateBase | wsdlTemplate |
GetAuthorization(IRequest)
Override Authorization Header resolution
View Source
public virtual string GetAuthorization(IRequest req)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
GetAuthRepository(IRequest)
Gets the registered ServiceStack.Auth.IAuthRepository
View Source
public virtual IAuthRepository GetAuthRepository(IRequest req = null)
Returns
ServiceStack.Auth.IAuthRepository
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
GetAuthRepositoryAsync(IRequest)
Gets the registered ServiceStack.Auth.IAuthRepositoryAsync Returns native IAuthRepositoryAsync if exists, a sync wrapper if IAuthRepository exists, otherwise null.
View Source
public virtual IAuthRepositoryAsync GetAuthRepositoryAsync(IRequest req = null)
Returns
ServiceStack.Auth.IAuthRepositoryAsync
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
GetBaseUrl(IRequest)
Override to customize the BaseUrl to use for this IRequest
View Source
public virtual string GetBaseUrl(IRequest httpReq)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | httpReq |
GetBearerToken(IRequest)
Override Authorization Bearer Token resolution
View Source
public virtual string GetBearerToken(IRequest req)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
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
public virtual ICacheClient GetCacheClient(IRequest req = null)
Returns
ServiceStack.Caching.ICacheClient
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
GetCacheClientAsync(IRequest)
Get registered ICacheClientAsync otherwise returns async wrapped sync ICacheClient
View Source
public virtual ICacheClientAsync GetCacheClientAsync(IRequest req = null)
Returns
ServiceStack.Caching.ICacheClientAsync
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
GetCompressionType(IRequest)
View Source
public virtual string GetCompressionType(IRequest request)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | request |
GetCookies(IHttpResponse)
Return the ICookies implementation to use
View Source
public virtual ICookies GetCookies(IHttpResponse res)
Returns
Parameters
Type | Name |
---|---|
ServiceStack.Web.IHttpResponse | res |
GetCustomErrorHandler(Int32)
Override to customize the IServiceStackHandler that should handle the specified errorStatusCode
View Source
public IServiceStackHandler GetCustomErrorHandler(int errorStatusCode)
Returns
ServiceStack.Host.Handlers.IServiceStackHandler
Parameters
Type | Name |
---|---|
System.Int32 | errorStatusCode |
GetCustomErrorHandler(HttpStatusCode)
Override to customize the IServiceStackHandler that should handle the specified HttpStatusCode
View Source
public IServiceStackHandler GetCustomErrorHandler(HttpStatusCode errorStatus)
Returns
ServiceStack.Host.Handlers.IServiceStackHandler
Parameters
Type | Name |
---|---|
System.Net.HttpStatusCode | errorStatus |
GetCustomErrorHttpHandler(HttpStatusCode)
Override to customize the IHttpHandler that should handle the specified HttpStatusCode
View Source
public IHttpHandler GetCustomErrorHttpHandler(HttpStatusCode errorStatus)
Returns
System.Web.IHttpHandler
Parameters
Type | Name |
---|---|
System.Net.HttpStatusCode | errorStatus |
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
public virtual IDbConnection GetDbConnection(IRequest req = null)
Returns
System.Data.IDbConnection
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.Web.IRequest | req | Provided by services and pageView, can be helpful when overriding this method |
|
GetDbConnection(String)
View Source
public virtual IDbConnection GetDbConnection(string namedConnection)
Returns
System.Data.IDbConnection
Parameters
Type | Name |
---|---|
System.String | namedConnection |
GetDbNamedConnection(IRequest)
View Source
public virtual string GetDbNamedConnection(IRequest req)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
GetDefaultSessionExpiry(IRequest)
Return the Default Session Expiry for this Request
View Source
public virtual TimeSpan GetDefaultSessionExpiry(IRequest req)
Returns
System.TimeSpan
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
GetJwtRefreshToken(IRequest)
Override JWT Refresh Token resolution
View Source
public virtual string GetJwtRefreshToken(IRequest req)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
GetJwtToken(IRequest)
Override JWT Token resolution
View Source
public virtual string GetJwtToken(IRequest req)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
GetMemoryCacheClient(IRequest)
Returns ServiceStack.Caching.MemoryCacheClient. cache is only persisted for this running app instance. Called by ServiceStack.Service.MemoryCacheClient
View Source
public virtual MemoryCacheClient GetMemoryCacheClient(IRequest req = null)
Returns
ServiceStack.Caching.MemoryCacheClient: Nullable MemoryCacheClient
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.Web.IRequest | req | Provided 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
public virtual IMessageProducer GetMessageProducer(IRequest req = null)
Returns
ServiceStack.Messaging.IMessageProducer
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.Web.IRequest | req | Provided 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
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
public IServiceStackHandler GetNotFoundHandler()
Returns
ServiceStack.Host.Handlers.IServiceStackHandler
GetPlugin(Type)
Looks for first plugin of this type in Plugins.
View Source
public IPlugin GetPlugin(Type pluginType)
Returns
Parameters
Type | Name |
---|---|
System.Type | pluginType |
GetPlugin<T>()
Looks for first plugin of this type in Plugins.
View Source
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
public virtual IRedisClient GetRedisClient(IRequest req = null)
Returns
ServiceStack.Redis.IRedisClient
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.Web.IRequest | req | Provided 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
public virtual ValueTask<IRedisClientAsync> GetRedisClientAsync(IRequest req = null)
Returns
ValueTask<ServiceStack.Redis.IRedisClientAsync>
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.Web.IRequest | req | Provided by services and pageView, can be helpful when overriding this method |
|
GetRefreshToken(IRequest)
Override Authorization Refresh Token resolution
View Source
public virtual string GetRefreshToken(IRequest req)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
GetRouteAttributes(Type)
Return the [Route] attributes for this Request DTO Type
View Source
public virtual RouteAttribute[] GetRouteAttributes(Type requestType)
Returns
ServiceStack.RouteAttribute[]
Parameters
Type | Name |
---|---|
System.Type | requestType |
GetRuntimeConfig<T>(IRequest, String, T)
Allow overriding ServiceStack runtime config like JWT Keys
View Source
public virtual T GetRuntimeConfig<T>(IRequest req, string name, T defaultValue)
Returns
<T>
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
System.String | name |
<T> | defaultValue |
Type Parameters
T
GetServiceGateway()
Get the configured ServiceStack.IServiceGateway
View Source
public virtual IServiceGateway GetServiceGateway()
Returns
GetServiceGateway(IRequest)
Get the configured ServiceStack.IServiceGateway for this request.
View Source
public virtual IServiceGateway GetServiceGateway(IRequest req)
Returns
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
GetTypesConfigForMetadata(IRequest)
Override to customize what DTOs are displayed on metadata pages
View Source
public virtual MetadataTypesConfig GetTypesConfigForMetadata(IRequest req)
Returns
ServiceStack.MetadataTypesConfig
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
GetVirtualFileSource<T>()
View Source
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
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
public virtual string GetWebRootPath()
Returns
System.String
HandleErrorResponse(IRequest, IResponse, HttpStatusCode, String)
Override to handle Forbidden Feature Error Responses
View Source
public void HandleErrorResponse(IRequest httpReq, IResponse httpRes, HttpStatusCode errorStatus, string errorStatusDescription = null)
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | httpReq |
ServiceStack.Web.IResponse | httpRes |
System.Net.HttpStatusCode | errorStatus |
System.String | errorStatusDescription |
HandleResponseException(IRequest, IResponse, String, Exception)
Override to intercept Response Exceptions
View Source
public virtual Task HandleResponseException(IRequest httpReq, IResponse httpRes, string operationName, Exception ex)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | httpReq |
ServiceStack.Web.IResponse | httpRes |
System.String | operationName |
System.Exception | ex |
HandleShortCircuitedErrors(IRequest, IResponse, Object)
Override to intercept Short Circuited Authentication Errors
View Source
public virtual async Task HandleShortCircuitedErrors(IRequest req, IResponse res, object requestDto)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
ServiceStack.Web.IResponse | res |
System.Object | requestDto |
HandleShortCircuitedErrors(IRequest, IResponse, Object, HttpStatusCode, String)
View Source
public virtual Task HandleShortCircuitedErrors(IRequest req, IResponse res, object requestDto, HttpStatusCode statusCode, string statusDescription = null)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
ServiceStack.Web.IResponse | res |
System.Object | requestDto |
System.Net.HttpStatusCode | statusCode |
System.String | statusDescription |
HandleUncaughtException(IRequest, IResponse, String, Exception)
View Source
[Obsolete("Use HandleResponseException")]
protected virtual Task HandleUncaughtException(IRequest httpReq, IResponse httpRes, string operationName, Exception ex)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | httpReq |
ServiceStack.Web.IResponse | httpRes |
System.String | operationName |
System.Exception | ex |
HasAccessToMetadata(IRequest, IResponse)
Override to return whether this request can access the metadata for the request
View Source
public bool HasAccessToMetadata(IRequest httpReq, IResponse httpRes)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | httpReq |
ServiceStack.Web.IResponse | httpRes |
HasFeature(Feature)
Return whether this App supports this feature
View Source
public bool HasFeature(Feature feature)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Feature | feature |
HasPlugin(Type)
Returns true if App has this plugin registered
View Source
public bool HasPlugin(Type pluginType)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.Type | pluginType |
HasPlugin<T>()
Returns true if App has this plugin registered
View Source
public bool HasPlugin<T>()
where T : class, IPlugin
Returns
System.Boolean
Type Parameters
T
HasUi()
View Source
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
public bool HasValidAuthSecret(IRequest httpReq)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | httpReq |
HttpCookieFilter(HttpCookie)
View Source
public virtual void HttpCookieFilter(HttpCookie cookie)
Parameters
Type | Name |
---|---|
System.Web.HttpCookie | cookie |
Init()
Initializes the AppHost. Calls the ServiceStack.ServiceStackHost.Configure(Funq.Container) method. Should be called before start.
View Source
public virtual ServiceStackHost Init()
Returns
IsReady()
Whether AppHost is ready configured and either ready to run or already running. Equals ServiceStack.ServiceStackHost.HasStarted
View Source
public static bool IsReady()
Returns
System.Boolean
LoadPlugin(IPlugin[])
Manually register Plugin to load
View Source
public virtual void LoadPlugin(params IPlugin[] plugins)
Parameters
Type | Name |
---|---|
ServiceStack.IPlugin[] | plugins |
LocalRedirect(IServiceBase, String, String)
View Source
public virtual IHttpResult LocalRedirect(IServiceBase service, string redirect, string message)
Returns
Parameters
Type | Name |
---|---|
ServiceStack.IServiceBase | service |
System.String | redirect |
System.String | message |
MapProjectPath(String)
Override to customize the physical path to return for this relativePath
View Source
public virtual string MapProjectPath(string relativePath)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | relativePath |
NormalizePathInfo(String, String)
Normalizes /path/info based on Config.HandlerFactoryPath
View Source
public static string NormalizePathInfo(string pathInfo, string mode)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | pathInfo |
System.String | mode |
OnAfterConfigChanged()
Override to intercept when the Config has changed
View Source
public virtual void OnAfterConfigChanged()
OnAfterExecute(IRequest, Object, Object)
Override to intercept the response of a ServiceStack Service request
View Source
public virtual object OnAfterExecute(IRequest req, object requestDto, object response)
Returns
System.Object
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
System.Object | requestDto |
System.Object | response |
OnAfterInit()
Override to intercept after the AppHost has been initialized
View Source
public virtual void OnAfterInit()
OnApplicationStarted()
View Source
public virtual void OnApplicationStarted()
OnApplicationStopping()
View Source
public virtual void OnApplicationStopping()
OnBeforeInit()
Override to intercept before the AppHost is initialized
View Source
public virtual void OnBeforeInit()
OnConfigLoad()
Override to intercept after the Config was loaded
View Source
public virtual void OnConfigLoad()
OnDeserializeJson(Type, Stream)
View Source
public virtual object OnDeserializeJson(Type intoType, Stream fromStream)
Returns
System.Object
Parameters
Type | Name |
---|---|
System.Type | intoType |
System.IO.Stream | fromStream |
OnEndRequest(IRequest)
Override to intercept the final callback after executing this Request
View Source
public virtual void OnEndRequest(IRequest request = null)
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | request |
OnExceptionTypeFilter(Exception, ResponseStatus)
Override to intercept & customize Exception responses
View Source
public virtual void OnExceptionTypeFilter(Exception ex, ResponseStatus responseStatus)
Parameters
Type | Name |
---|---|
System.Exception | ex |
ServiceStack.ResponseStatus | responseStatus |
OnGatewayException(IRequest, Object, Exception)
Occurs when the Service throws an Service Gateway Exception
View Source
public virtual async Task OnGatewayException(IRequest httpReq, object request, Exception ex)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | httpReq |
System.Object | request |
System.Exception | ex |
OnLogError(Type, String, Exception)
Callback for handling when errors are logged, also called for non-Exception error logging like 404 requests
View Source
public virtual void OnLogError(Type type, string message, Exception innerEx = null)
Parameters
Type | Name |
---|---|
System.Type | type |
System.String | message |
System.Exception | innerEx |
OnPostExecuteServiceFilter(IService, Object, IRequest, IResponse)
Executed immediately after a service is executed. Use return to change response used.
View Source
public virtual object OnPostExecuteServiceFilter(IService service, object response, IRequest httpReq, IResponse httpRes)
Returns
System.Object
Parameters
Type | Name |
---|---|
ServiceStack.IService | service |
System.Object | response |
ServiceStack.Web.IRequest | httpReq |
ServiceStack.Web.IResponse | httpRes |
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
public virtual object OnPreExecuteServiceFilter(IService service, object request, IRequest httpReq, IResponse httpRes)
Returns
System.Object
Parameters
Type | Name |
---|---|
ServiceStack.IService | service |
System.Object | request |
ServiceStack.Web.IRequest | httpReq |
ServiceStack.Web.IResponse | httpRes |
OnReady()
View Source
protected virtual void OnReady()
OnSaveSession(IRequest, IAuthSession, Nullable<TimeSpan>)
Override to intercept when Sessions using sync APIs are saved
View Source
[Obsolete("Use OnSaveSessionAsync")]
public virtual void OnSaveSession(IRequest httpReq, IAuthSession session, TimeSpan? expiresIn = null)
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | httpReq |
ServiceStack.Auth.IAuthSession | session |
System.Nullable<System.TimeSpan> | expiresIn |
OnSaveSessionAsync(IRequest, IAuthSession, Nullable<TimeSpan>, CancellationToken)
Override to intercept when Sessions using async APIs are saved
View Source
public virtual Task OnSaveSessionAsync(IRequest httpReq, IAuthSession session, TimeSpan? expiresIn = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | httpReq |
ServiceStack.Auth.IAuthSession | session |
System.Nullable<System.TimeSpan> | expiresIn |
System.Threading.CancellationToken | token |
OnSerializeJson(IRequest, Object, Stream)
View Source
public virtual void OnSerializeJson(IRequest req, object dto, Stream outputStream)
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
System.Object | dto |
System.IO.Stream | outputStream |
OnServiceException(IRequest, Object, Exception)
Occurs when the Service throws an Exception.
View Source
public virtual async Task<object> OnServiceException(IRequest httpReq, object request, Exception ex)
Returns
System.Threading.Tasks.Task<System.Object>
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | httpReq |
System.Object | request |
System.Exception | ex |
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
public virtual IAuthSession OnSessionFilter(IRequest req, IAuthSession session, string withSessionId)
Returns
ServiceStack.Auth.IAuthSession
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
ServiceStack.Auth.IAuthSession | session |
System.String | withSessionId |
OnStartupException(Exception)
Override to intercept Exceptions thrown at Startup. Use StrictMode to rethrow Startup Exceptions
View Source
public virtual void OnStartupException(Exception ex)
Parameters
Type | Name |
---|---|
System.Exception | ex |
OnStartupException(Exception, String, String)
View Source
public virtual void OnStartupException(Exception ex, string target, string method)
Parameters
Type | Name |
---|---|
System.Exception | ex |
System.String | target |
System.String | method |
OnUncaughtException(IRequest, IResponse, String, Exception)
Occurs when an exception is thrown whilst processing a request.
View Source
public virtual async Task OnUncaughtException(IRequest httpReq, IResponse httpRes, string operationName, Exception ex)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | httpReq |
ServiceStack.Web.IResponse | httpRes |
System.String | operationName |
System.Exception | ex |
PopulateArrayFilters()
View Source
protected void PopulateArrayFilters()
PostConfigurePlugin<T>(Action<T>)
Register a callback to configure a plugin just after it's registered
View Source
public void PostConfigurePlugin<T>(Action<T> configure)
where T : class, IPlugin
Parameters
Type | Name |
---|---|
System.Action<<T>> | configure |
Type Parameters
T
PublishMessage<T>(IMessageProducer, T)
Override to intercept MQ Publish Requests
View Source
public virtual void PublishMessage<T>(IMessageProducer messageProducer, T message)
Parameters
Type | Name |
---|---|
ServiceStack.Messaging.IMessageProducer | messageProducer |
<T> | message |
Type Parameters
T
Redirect(IServiceBase, String, String)
View Source
public virtual IHttpResult Redirect(IServiceBase service, string redirect, string message)
Returns
Parameters
Type | Name |
---|---|
ServiceStack.IServiceBase | service |
System.String | redirect |
System.String | message |
Register<T>(T)
Register singleton in the Ioc Container of the AppHost.
View Source
public virtual void Register<T>(T instance)
Parameters
Type | Name |
---|---|
<T> | instance |
Type Parameters
T
RegisterAs<T, TAs>()
Registers type to be automatically wired by the Ioc container of the AppHost.
View Source
public virtual void RegisterAs<T, TAs>()
where T : TAs
Type Parameters
Name | Description |
---|---|
T | Concrete type |
TAs | Abstract type |
RegisterLicenseKey(String)
View Source
protected virtual void RegisterLicenseKey(string licenseKeyText)
Parameters
Type | Name |
---|---|
System.String | licenseKeyText |
RegisterService(Type, String[])
Manually register ServiceStack Service at these routes
View Source
public virtual void RegisterService(Type serviceType, params string[] atRestPaths)
Parameters
Type | Name |
---|---|
System.Type | serviceType |
System.String[] | atRestPaths |
RegisterService<T>(String[])
Manually register ServiceStack Service at these routes
View Source
public virtual void RegisterService<T>(params string[] atRestPaths)
where T : IService
Parameters
Type | Name |
---|---|
System.String[] | atRestPaths |
Type Parameters
T
RegisterServicesInAssembly(Assembly)
Register all ServiceStack Services found in this Assembly
View Source
public void RegisterServicesInAssembly(Assembly assembly)
Parameters
Type | Name |
---|---|
System.Reflection.Assembly | assembly |
RegisterTypedMessageRequestFilter<T>(Action<IRequest, IResponse, T>)
Register Typed MQ Request Filter
View Source
public void RegisterTypedMessageRequestFilter<T>(Action<IRequest, IResponse, T> filterFn)
Parameters
Type | Name |
---|---|
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
public void RegisterTypedMessageResponseFilter<T>(Action<IRequest, IResponse, T> filterFn)
Parameters
Type | Name |
---|---|
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
public void RegisterTypedRequestFilter<T>(Action<IRequest, IResponse, T> filterFn)
Parameters
Type | Name |
---|---|
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
public void RegisterTypedRequestFilter<T>(Func<Container, ITypedFilter<T>> filter)
Parameters
Type | Name |
---|---|
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
public void RegisterTypedRequestFilterAsync<T>(Func<Container, ITypedFilterAsync<T>> filter)
Parameters
Type | Name |
---|---|
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
public void RegisterTypedRequestFilterAsync<T>(Func<IRequest, IResponse, T, Task> filterFn)
Parameters
Type | Name |
---|---|
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
public void RegisterTypedResponseFilter<T>(Action<IRequest, IResponse, T> filterFn)
Parameters
Type | Name |
---|---|
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
public void RegisterTypedResponseFilter<T>(Func<Container, ITypedFilter<T>> filter)
Parameters
Type | Name |
---|---|
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
public void RegisterTypedResponseFilterAsync<T>(Func<Container, ITypedFilterAsync<T>> filter)
Parameters
Type | Name |
---|---|
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
public void RegisterTypedResponseFilterAsync<T>(Func<IRequest, IResponse, T, Task> filterFn)
Parameters
Type | Name |
---|---|
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
public virtual void Release(object instance)
Parameters
Type | Name |
---|---|
System.Object | instance |
Resolve<T>()
Resolves Type through the Ioc container of the AppHost.
View Source
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
public virtual string ResolveAbsoluteUrl(string virtualPath, IRequest httpReq)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | virtualPath |
ServiceStack.Web.IRequest | httpReq |
ResolveLocalizedString(String, IRequest)
Override to use a localized string for internal routes & text used by ServiceStack
View Source
public virtual string ResolveLocalizedString(string text, IRequest request = null)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | text |
ServiceStack.Web.IRequest | request |
ResolveLocalizedStringFormat(String, Object[], IRequest)
Override to use a localized string for internal routes & text used by ServiceStack
View Source
public virtual string ResolveLocalizedStringFormat(string text, object[] args, IRequest request = null)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | text |
System.Object[] | args |
ServiceStack.Web.IRequest | request |
ResolvePathInfo(IRequest, String)
Override to customize normalized /path/info to use for this request
View Source
public virtual string ResolvePathInfo(IRequest request, string originalPathInfo)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | request |
System.String | originalPathInfo |
ResolvePhysicalPath(String, IRequest)
Override to customize the Physical Path for this virtualPath for this IRequest
View Source
public virtual string ResolvePhysicalPath(string virtualPath, IRequest httpReq)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | virtualPath |
ServiceStack.Web.IRequest | httpReq |
ReturnRedirectHandler(IHttpRequest)
Override to customize Redirect Responses
View Source
public virtual IHttpHandler ReturnRedirectHandler(IHttpRequest httpReq)
Returns
System.Web.IHttpHandler
Parameters
Type | Name |
---|---|
ServiceStack.Web.IHttpRequest | httpReq |
ReturnRequestInfoHandler(IHttpRequest)
Override to customize IHttpHandler used to service ?debug=requestinfo requests
View Source
public virtual IHttpHandler ReturnRequestInfoHandler(IHttpRequest httpReq)
Returns
System.Web.IHttpHandler
Parameters
Type | Name |
---|---|
ServiceStack.Web.IHttpRequest | httpReq |
SetConfig(HostConfig)
Set the host config of the AppHost.
View Source
public virtual void SetConfig(HostConfig config)
Parameters
Type | Name |
---|---|
ServiceStack.HostConfig | config |
SetCookieFilter(IRequest, Cookie)
Override built-in Cookies, return false to prevent the Cookie from being set.
View Source
public virtual bool SetCookieFilter(IRequest req, Cookie cookie)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
System.Net.Cookie | cookie |
ShouldCompressFile(IVirtualFile)
Override to return whether static files should be sent compressed or not (if supported by UserAgent)
View Source
public virtual bool ShouldCompressFile(IVirtualFile file)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.IO.IVirtualFile | file |
ShouldProfileRequest(IRequest)
View Source
public virtual bool ShouldProfileRequest(IRequest req)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
Start(String)
Starts the AppHost. this methods needs to be overwritten in subclass to provider a listener to start handling requests.
View Source
public virtual ServiceStackHost Start(string urlBase)
Returns
Parameters
Type | Name | Description |
---|---|---|
System.String | urlBase | Url to listen to |
|
TryGetCurrentRequest()
Overriden by AppHost's to return the current IRequest if it supports singleton access to the Request Context
View Source
public virtual IRequest TryGetCurrentRequest()
Returns
TryGetNativeCacheClient(IRequest, out ICacheClient, out ICacheClientAsync)
Only sets cacheAsync if native Async provider, otherwise sets cacheSync
View Source
public virtual void TryGetNativeCacheClient(IRequest req, out ICacheClient cacheSync, out ICacheClientAsync cacheAsync)
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
ServiceStack.Caching.ICacheClient | cacheSync |
ServiceStack.Caching.ICacheClientAsync | cacheAsync |
TryGetUserId(IRequest)
Try infer UserId from IRequest
View Source
public virtual string TryGetUserId(IRequest req)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
TryResolve<T>()
Tries to resolve type through the ioc container of the AppHost. Can return null.
View Source
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
public Exception UseException(Exception ex)
Returns
System.Exception
Parameters
Type | Name |
---|---|
System.Exception | ex |
UseHttps(IRequest)
Override to change whether absolute links should use https:// URLs
View Source
public virtual bool UseHttps(IRequest httpReq)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | httpReq |
WriteAutoHtmlResponseAsync(IRequest, Object, String, Stream)
Override to intercept auto HTML Page Response
View Source
public virtual async Task WriteAutoHtmlResponseAsync(IRequest request, object response, string html, Stream outputStream)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | request |
System.Object | response |
System.String | html |
System.IO.Stream | outputStream |
WriteSoapMessage(IRequest, Message, Stream)
View Source
public virtual void WriteSoapMessage(IRequest req, Message message, Stream outputStream)
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
System.ServiceModel.Channels.Message | message |
System.IO.Stream | outputStream |
Implements
- ServiceStack.IAppHost
- ServiceStack.Configuration.IResolver
System.IDisposable