Application Insights tracking only failed ASP.NET MVC Web API requests

做~自己de王妃 提交于 2019-12-19 10:02:36

问题


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

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

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

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

The problem is that if the operation SUCCEEDS (status code 200) nothing is recorded in 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.

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

Can anyone help?


回答1:


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

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>-->


来源:https://stackoverflow.com/questions/44971641/application-insights-tracking-only-failed-asp-net-mvc-web-api-requests

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!