Info Filters

The debug info filters provide an easy to inspect the state of a remote ServiceStack Instance by making a number of metadata objects and APIs available to query. The TemplateInfoFilters are pre-registered in ServiceStack's TemplatePagesFeature. You can make them available in a TemplateContext with:

var context = new TemplatePagesFeature 
{
    TemplateFilters = { new TemplateInfoFilters() }
}.Init();

Info Filters

Filter Name API Mapping
Environment APIs
envVariable Environment.GetEnvironmentVariable(variable)
envExpandVariables Environment.ExpandEnvironmentVariables(name)
envProcessorCount Environment.ProcessorCount
envTickCount Environment.TickCount
envServerUserAgent Env.ServerUserAgent
envServiceStackVersion Env.ServiceStackVersion
envIsWindows Env.IsWindows (net45) / IsOSPlatform(Windows) (netcore)
envIsLinux Env.IsLinux (net45) / IsOSPlatform(Linux) (netcore)
envIsOSX Env.IsOSX (net45) / IsOSPlatform(OSX) (netcore)
networkIpv4Addresses GetAllNetworkInterfaceIpv4Addresses()
networkIpv6Addresses GetAllNetworkInterfaceIpv6Addresses()
ServiceStack User APIs
userSession IRequest.GetSession()
userSessionId IRequest.GetSessionId()
userSession IRequest.GetSession()
userPermanentSessionId IRequest.GetPermanentSessionId()
userSessionOptions IRequest.GetSessionOptions()
userHasRole IAuthSession.HasRole(role)
userHasPermission IAuthSession.HasPermission(permission)
ServiceStack Metadata APIs
metaAllDtos Metadata.GetAllDtos()
metaAllDtoNames Metadata.GetOperationDtos(x => x.Name)
metaAllOperations Metadata.Operations
metaAllOperationNames Metadata.GetAllOperationNames()
metaAllOperationTypes Metadata.GetAllOperationTypes()
metaOperation Metadata.GetOperation(name)

/metadata/debug

Debug Template

Metadata Debug Templates Screenshot

The Debug Template is a Service in TemplatePagesFeature that's pre-registered in DebugMode. The Service can also be available when not in DebugMode by enabling it with:

Plugins.Add(new TemplatePagesFeature { 
    EnableDebugTemplate = true
})

This registers the Service but limits it to Users with the Admin role, alternatively you configure an Admin Secret Key:

SetConfig(new HostConfig { AdminAuthSecret = "secret" })

Which will let you access it by appending the authsecret to the querystring: /metadata/debug?authsecret=secret

Alternatively if preferred you can make the Debug Template Service available to all users with:

Plugins.Add(new TemplatePagesFeature { 
    EnableDebugTemplateToAll = true
})

Which is the configuration used in this .NET Core App which makes the Debug Template Service accessible to everyone:

/metadata/debug

Debug Templates are executed in a new TemplateContext instance pre-configured with the above TemplateInfoFilters and a copy of any context arguments in TemplatePagesFeature which is the only thing it can access from the plugin.

In addition to TemplatePagesFeature arguments, they're also populated with the following additional arguments:

request The current IHttpRequest
appHost The ServiceStack AppHost Instance
appConfig ServiceStack's AppHost Configuration
appVirtualFilesPath The Read/Write IVirtualFiles (aka ContentRootPath)
appVirtualFileSourcesPath Multiple read-only Virtual File Sources (aka WebRootPath)
meta ServiceStack Metadata Services Object

See the Filters API Reference for the full list of Info filters available.

made with by ServiceStack