2012-11-19 72 views
1

如何使用PersistenConnection上的跟蹤?在SignalR中使用跟蹤

public class Connection : PersistentConnection 
{ 
    protected override Task OnConnectedAsync(IRequest request, string connectionId) 
    { 
     Trace.TraceInformation("ConnectedAsync ConnectionId:{0}", connectionId); 
     return base.OnConnectedAsync(request, connectionId); 
    } 
} 

如何附加Trace偵聽器,以便TraceInformation調用中的信息變得可見?

+0

這似乎不是SignalR特有的。 – davidfowl

回答

1

打開所有內容:

using Microsoft.AspNet.SignalR.Tracing;

public StockTickerHub(StockTicker stockTicker) 
{ 
    _stockTicker = stockTicker; 
    ITraceManager traceManager = GlobalHost.DependencyResolver.Resolve<ITraceManager>(); 
    traceManager.Switch.Level = SourceLevels.All; 
}