如何在PersistenConnection上使用Trace?
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 :(得分:1)
打开所有内容:
使用Microsoft.AspNet.SignalR.Tracing;
public StockTickerHub(StockTicker stockTicker)
{
_stockTicker = stockTicker;
ITraceManager traceManager = GlobalHost.DependencyResolver.Resolve<ITraceManager>();
traceManager.Switch.Level = SourceLevels.All;
}