Skip to content
Switch branches/tags
Go to file
Cannot retrieve contributors at this time
title: Introspect State
order: 5
Since #Script's are executable at runtime without precompilation it's a great tool for running
live queries to inspect the state of a running .NET App within a controlled window sandbox.
Here's an example of querying a Server's state:
form textarea {
padding: 10px;
width: 100%;
height: 600px;
<form action="/introspect/state">
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#process-template" role="tab">process</a>
<div class="tab-content">
<div class="tab-pane active" id="process-template" role="tabpanel">
<textarea name="Page"
autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false">{{ 'examples/introspect.html' |> includeFile }}</textarea>
<hr style="margin:20px 0">
<div id="output"></div>
{{ `<script>
dataType: 'html',
success: function(r) {
</script>` |> raw |> to => scripts }}
<hr style="margin:20px 0">
To implement <a href="">IntrospectStateServices.cs</a>
we created a separate Service using a new <em>ScriptContext</em> instance with a custom set of filters which just exposes the APIs
we want to be able to query:
<h4><a href="">IntrospectStateServices.cs</a></h4>
{{ 'gfm/introspect-state/' |> githubMarkdown }}
<h4 id="client-ui">Client UI</h4>
Then to implement the
<a href="">Client UI</a>
we just used a FORM containing Bootstrap Tabs that only uses this custom javascript:
{{ 'gfm/introspect-state/' |> githubMarkdown }}
Which calls the generic <em>ajaxPreview</em> jQuery plugin in
<a href="">default.js</a>
to make an ajax request on every text box change.
<h3>Debug Inspector</h3>
As this feature is an extremely useful way to inspect the state of a remote .NET or .NET Core App it's an embedded feature in
ServiceStack which is automatically registered in <a href="">DebugMode</a>
which can optionally be made available to everyone with:
{{ 'gfm/introspect-state/' |> githubMarkdown }}
Which we've done in this App so you can inspect this Servers State from:
<h4><a href="/metadata/debug">/metadata/debug</a></h4>
{{ "usecase-links" |> partial({ order }) }}