【发布时间】:2016-09-20 13:16:34
【问题描述】:
我有一个 asp.net 核心网络应用程序,我想使用 metrics.net。
之前,我像这样配置指标和 owin:
Metric.Config
.WithInternalMetrics()
.WithOwin(middleware => app.Use(middleware), config => config
.WithRequestMetricsConfig(c => c.WithErrorsMeter()
.WithActiveRequestCounter()
.WithPostAndPutRequestSizeHistogram()
.WithRequestTimer()
, new[] {
new Regex("(?i)^metrics"),
new Regex("(?i)^health"),
new Regex("(?i)^json")
}
)
.WithMetricsEndpoint(endpointConfig =>
{
endpointConfig
.MetricsTextEndpoint(enabled: false);
})
);
我怎样才能在asp net core中做一些类似的事情?
【问题讨论】:
-
Metric.net 还不支持 dotnet 核心。您只能在完整的框架中使用它。看这里docs.asp.net。 GitHub issue
-
@Kalten:您可以在(标准).NET Framework 上运行 ASP.NET Core。使用 Johan 的回答,我能够成功地为 Metrics.NET 配置 OWIN 适配器。
标签: c# asp.net-core metrics