0

In ServiceStack I am using the MiniProfiler configured to store profiles using SqlServerStorage. The profiles are being recorded to the database into the 'MiniProfilers' table without issue. Is there a viewer that would render the data (especially the json) from the MiniProfilers table?

This sample shows how SqlServerStorage is being initialized. The method is called from the AppHost.cs on Configure:

    private void EnableProfiling(string profilerConnection)
    {
        using (var conn = new SqlConnection(profilerConnection))
        {
            conn.Open();
            var miniProfilersTableExists = conn.ExecuteScalar<int>("select case when exists((select * from information_schema.tables where table_name = 'MiniProfilers')) then 1 else 0 end");
            if (miniProfilersTableExists != 1)
                conn.Execute(SqlServerStorage.TableCreationScript);
        }
        Profiler.Settings.Storage = new SqlServerStorage(profilerConnection);          
    }
jacksonakj
  • 882
  • 1
  • 11
  • 21

1 Answers1

0

In your HTML page (just before </HEAD>) add the following line

@ServiceStack.MiniProfiler.Profiler.RenderIncludes().AsRaw()

In Application_Start (Global.asax) add the following lines

Profiler.Settings.PopupRenderPosition = RenderPosition.Left;
Profiler.Settings.SqlFormatter = new SqlServerFormatter();

It will display a tiny tab at the top left corner of your page in which you can click to reveal more information.

labilbe
  • 3,501
  • 2
  • 29
  • 34
  • Thank you, I was able to get that working for a single page. However, I am looking to get a similar view but for the profile history that is recorded by the SqlServerStorage class. My goal is to be able to review profiles recorded by any request made to the service not just the current one. I edited my original post with the code that enables SqlServerStorage. – jacksonakj Jul 22 '15 at 02:03