The solution in this case seems to be to just use the standard MiniProfiler library instead of the one included with ServiceStack.
Initial Setup
In the Nuget package installer, I ran:
Install-Package MiniProfiler
Install-Package MiniProfiler.MVC4
I modified global.asax
in the following ways:
private void Application_BeginRequest(object sender, EventArgs e)
{
MiniProfiler.Start();
}
private void Application_AuthenticateRequest(object sender, EventArgs e)
{
//stops the profiler if the user isn't on the tech team
var currentUser = ClaimsPrincipal.Current.Identity as ClaimsIdentity;
if (!Request.IsLocal && !currentUser.GetGlobalRoles().Contains(Constant.Roles.TechTeam))
{
MiniProfiler.Stop(discardResults:true);
}
}
private void Application_EndRequest(object sender, EventArgs e)
{
MiniProfiler.Stop();
}
Then, in my Layout.cshtml
file, before the end of the body tag, I placed:
@MiniProfiler.RenderIncludes()
</body>
</html>
Profiling a DB Connection
In the section of code that returns my OrmLiteConnectionFactory, I use the following code:
private OrmLiteConnectionFactory claimFactory = new OrmLiteConnectionFactory(ConfigurationManager.ConnectionStrings["MyConnectionString"].ToString(), true, SqlServerDialect.Provider)
{
ConnectionFilter = x => new ProfiledDbConnection(x as System.Data.SqlClient.SqlConnection, MiniProfiler.Current)
};
This seems to profile the SQL and connections just fine.