Application Insights仅跟踪失败的ASP.NET MVC Web API请求 [英] Application Insights tracking only failed ASP.NET MVC Web API requests

查看:52
本文介绍了Application Insights仅跟踪失败的ASP.NET MVC Web API请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ASP.NET Web API控制器,提供了saveAndNew操作.

I have a ASP.NET Web API controller that provides a saveAndNew operation.

该类按预期派生自System.Web.Http.ApiController.

This class is derived from System.Web.Http.ApiController as expected.

已使用SDK的2.1.0版本和ApplicationInsights.config中的默认设置正确配置了Application Insights.

Application Insights is correctly configured using version 2.1.0 of the SDK and the default settings in ApplicationInsights.config.

如果对提到的操作的请求失败-例如状态码为400-该请求已正确记录在App Insights中.

If a request to the mentioned operation fails - for example with status code 400 - the request is recorded correctly in App Insights.

问题在于如果操作成功(状态码200)没有记录在Application Insights中.

The problem is that if the operation SUCCEEDS (status code 200) nothing is recorded in Application Insights.

我已经使用Fiddler来查看是否向App Insights跟踪服务发出了请求,但是否发出了请求.因此,问题不在Azure门户上的Application Insights配置中.

I've used Fiddler to see if the request is made to the App Insights track service and it is not. So the problem is not in the configuration of Application Insights on the Azure portal.

我无法弄清楚是什么导致无法记录对Web API控制器操作的所有请求.

I can't figure out what is preventing ALL requests to my Web API controllers operations from being recorded.

任何人都可以帮忙吗?

推荐答案

您可能希望尝试删除/注释

You might want to try removing/commenting out TransferRequestHandler in ApplicationInsights.config file.

GitHub问题"REST API应用程序可以过滤掉所有请求"

GitHub issue "REST API app can have all requests filtered out" here states that: "commenting out the one line in the ApplicationInsights.config caused successful requests to start getting logged. Web API 2 project.

<!--<Add>System.Web.Handlers.TransferRequestHandler</Add>-->

这篇关于Application Insights仅跟踪失败的ASP.NET MVC Web API请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆