我正在开发一个遗留的asp.net aspx网页应用程序。(.net framework v4.6.2)。我们希望设置Azure AppInsights日志记录来跟踪我们的应用日志。我们想要实现的最重要的方面是在App Insights中查看SQL依赖关系(查看执行/调用的SQL上下文/代码的能力)。目标:记录服务器代码正在执行的SQL命令文本。
我试着用谷歌搜索了很多文章,但大多数都是关于。net核心的,这是没有帮助的
我试着读了这篇文章:https://learn.microsoft.com/en-us/azure/azure-monitor/app/asp-net
但我仍然无法查看sql日志
我试着读了这篇文章:https://learn.microsoft.com/en-us/azure/azure-monitor/app/asp-net
添加了Azure appinsights Nuget包,添加了Log 4 net来记录跟踪信息
有时候,我甚至看不到正常的日志,比如API调用等。
任何帮助/指导都非常感谢
1条答案
按热度按时间clj7thdc1#
检查以下解决方法,以在Application Insights for
Asp.Net Framework
Application中跟踪SQL查询和依赖关系。ApplicationInsights.config
文件中添加Application Insights连接字符串。ApplicationInsights.config
中的<TelemetryModules>
下添加了以下设置。Web.config
已添加以下设置。Connection string
添加到Web.config
的配置部分或添加到控制器本身。我在Controller中的代码:
我引用了MSDoc和1和2中的代码
Application Insights中的跟踪:
依赖项: