Skip to content

UseFonlowTraceHub

fonlow edited this page May 14, 2017 · 12 revisions

Use Fonlow.TraceHub

This is an ASP.NET MVC / Web API project, and currently the auth is utilizing ASP.NET Identity 2. You have a choice to use the existing auth system, or the one coming with this project. Because by the nature of TraceHub, there will probably be just a few technical users would be using it. To make things simple, using the Identity system coming with this project could be a good choice.

Security

While TraceHub is heavily utilizing SignalR, the security of SignalR is governed by ASP.NET Identity 2 also used in MVC / Web API. And the role of the LoggingHub is always "API", as illustrated in the following code snippet:

    [Microsoft.AspNet.SignalR.Authorize(Roles = "API")]
    [Microsoft.AspNet.SignalR.Hubs.HubName("loggingHub")]
    public class LoggingHub : Hub<ILoggingClient>, ILogging

Database

By default, TraceHub is using ASP.NET Identity 2, since the Web service was developed on top of ASP.NET Web API and MVC. Officially TraceHub supports MS SQL and MySql/MariaDB through Entity Framework, while you should be able to change Web.config to support SQL Express, SQL Compact without modifying source codes.

If you like to use existing Identity database shared by multiple applications, you just need to add a new role called “API” to table aspnetroles, and then add a user with this role. Please note, role name is case sensitive.

Deployments

You can install TraceHub MVC in a few ways.

Original Source

  1. Download or clone the TraceHub repository.
  2. Build and deploy the TraceHub MVC project.

Integrate with your existing ASP.NET Website

  1. Download or clone the TraceHub repository.
  2. Modify web.config of the TraceHub MVC project and modify the connection string for pointing to your existing Identity 2 database. And make sure at least one user of role "API" is created.
  3. Add appSettings for TraceHubSlim in Web.confg.
  4. Build and deploy the TraceHub MVC project.

Remarks:

The steps described here is quite rough, however, presuming you have done deployments of ASP.NET MVC/Web API and WCF many times. In ASP.NET MVC / Web API, the usages of security and database are configurable. Generally it should be easy to integrate TraceHub MVC with your existing auth server and Identity 2 database, provided your existing architectural designs respect AuthorizeAttribute classes in various ASP.NET namespaces.

Write Trace to TraceHub

The preferred way is to Use Fonlow.HubTraceListener by your service applications.

Trace Display Format

By default, the Web page displays 4 columns:

  1. Trace event type.
  2. Event time. The Web page displays event time in local timezone of the computing device. In PC, mouse hovering the time cell will result in displaying event time UTC.
  3. Origin of the event. This is value of the instanceId attribute of the HubTraceListener config. By default, all lines in a trace message is displayed in one line with wrap. Clicking on an Origin cell may display the trace message in multiple lines.
  4. Trace message. This is formatted by HubTraceListener according to the template attribute. Therefore, generally in the template attribute you don't need to include EventType, and one of the time parameters.