HostContext
Assembly: ServiceStack.dll
View Source
public static class HostContext
Properties
RequestContext
View Source
public static RequestContext RequestContext { get; }
AppHost
View Source
public static ServiceStackHost AppHost { get; }
IsAspNetHost
View Source
public static bool IsAspNetHost { get; }
IsHttpListenerHost
View Source
public static bool IsHttpListenerHost { get; }
IsNetCore
View Source
public static bool IsNetCore { get; }
Container
View Source
public static Container Container { get; }
ServiceController
View Source
public static ServiceController ServiceController { get; }
MetadataPagesConfig
View Source
public static MetadataPagesConfig MetadataPagesConfig { get; }
ContentTypes
View Source
public static IContentTypes ContentTypes { get; }
Config
View Source
public static HostConfig Config { get; }
AppSettings
View Source
public static IAppSettings AppSettings { get; }
Metadata
View Source
public static ServiceMetadata Metadata { get; }
ServiceName
View Source
public static string ServiceName { get; }
DebugMode
View Source
public static bool DebugMode { get; }
StrictMode
View Source
public static bool StrictMode { get; }
TestMode
View Source
public static bool TestMode { get; set; }
VirtualFiles
Read/Write Virtual FileSystem. Defaults to FileSystemVirtualPathProvider
View Source
public static IVirtualFiles VirtualFiles { get; }
VirtualFileSources
Cascading collection of virtual file sources, inc. Embedded Resources, File System, In Memory, S3
View Source
public static IVirtualPathProvider VirtualFileSources { get; }
RootDirectory
The WebRoot VFS Directory of VirtualFilesSources
View Source
public static IVirtualDirectory RootDirectory { get; }
ContentRootDirectory
The ContentRoot VFS Directory of VirtualFiles
View Source
public static IVirtualDirectory ContentRootDirectory { get; }
FileSystemVirtualFiles
The FileSystem VirtualFiles provider in VirtualFileSources
View Source
public static FileSystemVirtualFiles FileSystemVirtualFiles { get; }
MemoryVirtualFiles
The Memory VirtualFiles provider in VirtualFileSources
View Source
public static MemoryVirtualFiles MemoryVirtualFiles { get; }
GistVirtualFiles
The GistVirtualFiles provider in VirtualFileSources (if any)
View Source
public static GistVirtualFiles GistVirtualFiles { get; }
Cache
View Source
public static ICacheClient Cache { get; }
CacheClientAsync
View Source
public static ICacheClientAsync CacheClientAsync { get; }
LocalCache
View Source
public static MemoryCacheClient LocalCache { get; }
DefaultOperationNamespace
View Source
public static string DefaultOperationNamespace { get; set; }
Fields
Async
View Source
public static AsyncContext Async
Methods
AssertAppHost()
View Source
public static ServiceStackHost AssertAppHost()
Returns
TryResolve<T>()
View Source
public static T TryResolve<T>()
Returns
<T>
Type Parameters
T
Resolve<T>()
View Source
public static T Resolve<T>()
Returns
<T>
Type Parameters
T
ApplyCustomHandlerRequestFilters(IRequest, IResponse)
View Source
public static bool ApplyCustomHandlerRequestFilters(IRequest httpReq, IResponse httpRes)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | httpReq |
ServiceStack.Web.IResponse | httpRes |
ApplyPreRequestFilters(IRequest, IResponse)
View Source
public static bool ApplyPreRequestFilters(IRequest httpReq, IResponse httpRes)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | httpReq |
ServiceStack.Web.IResponse | httpRes |
ApplyRequestFiltersAsync(IRequest, IResponse, Object)
View Source
public static Task ApplyRequestFiltersAsync(IRequest httpReq, IResponse httpRes, object requestDto)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | httpReq |
ServiceStack.Web.IResponse | httpRes |
System.Object | requestDto |
ApplyResponseFiltersAsync(IRequest, IResponse, Object)
View Source
public static Task ApplyResponseFiltersAsync(IRequest httpReq, IResponse httpRes, object response)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | httpReq |
ServiceStack.Web.IResponse | httpRes |
System.Object | response |
CreateServiceRunner<TRequest>(ActionContext)
View Source
public static IServiceRunner<TRequest> CreateServiceRunner<TRequest>(ActionContext actionContext)
Returns
ServiceStack.Web.IServiceRunner<TRequest>
Parameters
Type | Name |
---|---|
ServiceStack.Host.ActionContext | actionContext |
Type Parameters
TRequest
AssertPlugin<T>()
View Source
public static T AssertPlugin<T>()
where T : class, IPlugin
Returns
<T>
Type Parameters
T
GetPlugin<T>()
View Source
public static T GetPlugin<T>()
where T : class, IPlugin
Returns
<T>
Type Parameters
T
HasPlugin<T>()
View Source
public static bool HasPlugin<T>()
where T : class, IPlugin
Returns
System.Boolean
Type Parameters
T
Release(Object)
View Source
public static void Release(object service)
Parameters
Type | Name |
---|---|
System.Object | service |
UnauthorizedAccess(RequestAttributes)
View Source
public static UnauthorizedAccessException UnauthorizedAccess(RequestAttributes requestAttrs)
Returns
System.UnauthorizedAccessException
Parameters
Type | Name |
---|---|
ServiceStack.RequestAttributes | requestAttrs |
ResolveLocalizedString(String, IRequest)
View Source
public static string ResolveLocalizedString(string text, IRequest request = null)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | text |
ServiceStack.Web.IRequest | request |
ResolveAbsoluteUrl(String, IRequest)
View Source
public static string ResolveAbsoluteUrl(string virtualPath, IRequest httpReq)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | virtualPath |
ServiceStack.Web.IRequest | httpReq |
ResolvePhysicalPath(String, IRequest)
View Source
public static string ResolvePhysicalPath(string virtualPath, IRequest httpReq)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | virtualPath |
ServiceStack.Web.IRequest | httpReq |
GetDefaultNamespace()
View Source
public static string GetDefaultNamespace()
Returns
System.String
RaiseServiceException(IRequest, Object, Exception)
View Source
public static Task<object> RaiseServiceException(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 |
RaiseUncaughtException(IRequest, IResponse, String, Exception)
View Source
public static Task RaiseUncaughtException(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 |
RaiseGatewayException(IRequest, Object, Exception)
View Source
public static Task RaiseGatewayException(IRequest httpReq, object request, Exception ex)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | httpReq |
System.Object | request |
System.Exception | ex |
RaiseAndHandleException(IRequest, IResponse, String, Exception)
View Source
public static async Task RaiseAndHandleException(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 |
ResolveService<T>(HttpContextBase)
Resolves and auto-wires a ServiceStack Service from a ASP.NET HttpContext.
View Source
public static T ResolveService<T>(HttpContextBase httpCtx = null)
where T : class, IRequiresRequest
Returns
<T>
Parameters
Type | Name |
---|---|
System.Web.HttpContextBase | httpCtx |
Type Parameters
T
ResolveService<T>(HttpListenerContext)
Resolves and auto-wires a ServiceStack Service from a HttpListenerContext.
View Source
public static T ResolveService<T>(HttpListenerContext httpCtx)
where T : class, IRequiresRequest
Returns
<T>
Parameters
Type | Name |
---|---|
System.Net.HttpListenerContext | httpCtx |
Type Parameters
T
ResolveService<T>(IRequest)
Resolves and auto-wires a ServiceStack Service.
View Source
public static T ResolveService<T>(IRequest httpReq)
where T : class, IRequiresRequest
Returns
<T>
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | httpReq |
Type Parameters
T
ResolveService<T>(IRequest, T)
View Source
public static T ResolveService<T>(IRequest httpReq, T service)
Returns
<T>
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | httpReq |
<T> | service |
Type Parameters
T
HasValidAuthSecret(IRequest)
View Source
public static bool HasValidAuthSecret(IRequest httpReq)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | httpReq |
HasFeature(Feature)
View Source
public static bool HasFeature(Feature feature)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Feature | feature |
GetCurrentRequest()
View Source
public static IRequest GetCurrentRequest()
Returns
TryGetCurrentRequest()
View Source
public static IRequest TryGetCurrentRequest()
Returns
GetAuthSecretSession()
View Source
public static IAuthSession GetAuthSecretSession()
Returns
ServiceStack.Auth.IAuthSession
FindFreeTcpPort(Int32, Int32)
View Source
public static int FindFreeTcpPort(int startingFrom = 5000, int endingAt = 65535)
Returns
System.Int32
Parameters
Type | Name |
---|---|
System.Int32 | startingFrom |
System.Int32 | endingAt |
ConfigureAppHost(Action<ServiceStackHost>, Action<ServiceStackHost>, Action<ServiceStackHost>, Action<ServiceStackHost>)
View Source
public static void ConfigureAppHost(Action<ServiceStackHost> beforeConfigure = null, Action<ServiceStackHost> afterConfigure = null, Action<ServiceStackHost> afterPluginsLoaded = null, Action<ServiceStackHost> afterAppHostInit = null)
Parameters
Type | Name |
---|---|
System.Action<ServiceStack.ServiceStackHost> | beforeConfigure |
System.Action<ServiceStack.ServiceStackHost> | afterConfigure |
System.Action<ServiceStack.ServiceStackHost> | afterPluginsLoaded |
System.Action<ServiceStack.ServiceStackHost> | afterAppHostInit |
Reset()
View Source
public static void Reset()