我正在嘗試在我的配置方法中記錄每個(gè)請(qǐng)求(.net core 2.2)的運(yùn)行時(shí)間,如下所示:public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory){ app.Use(async (context, next) => { Logging.Log.Id = Convert.ToString(new Activity(string.Empty).Id); var sw = new Stopwatch(); sw.Start(); await next.Invoke(); sw.Stop(); Logging.Log.Info($"ElapsedTime: {sw.ElapsedMilliseconds}"); }); // rest of method code omitted } 隨著經(jīng)過的時(shí)間,我想顯示調(diào)用了哪個(gè)端點(diǎn)或請(qǐng)求前往的絕對(duì) uri。我怎樣才能從上下文對(duì)象中獲得相同的信息。
- 1 回答
- 0 關(guān)注
- 153 瀏覽
添加回答
舉報(bào)
0/150
提交
取消