【App Service】解决 .NET Profiler 报告打开后无数据加载的问题

本文涉及的产品
Serverless 应用引擎 SAE,800核*时 1600GiB*时
容器服务 Serverless 版 ACK Serverless,952元额度 多规格
简介: Azure App Service 上的应用遭遇性能问题时,可以使用Profiler收集.NET应用的Trace,它在60秒内自动停止,不会重启应用。若Trace报告加载失败,可能是由于资源如`angular.min.js`无法访问。解决办法是找到中国区Azure可访问的资源副本,例如使用BootCDN替代Google API,然后通过App Service的Kudu控制台编辑HTML文件进行替换。完成替换后,Profiler报告应能正常加载。

问题描述

App Service上可以收.NET 应用的Profile Trace文件,并且可以自动分析报告。

Collect a Profiler Trace

If your app is down or performing slow, you can collect a profiling trace to identify the root cause of the issue. Profiling is light weight and is designed for production scenarios.

What you should know before collecting a Profiler trace

  • Once the profiler trace is started, reproduce the issue by browsing to the web app.
  • The profiler trace will automatically stop after 60 seconds.
  • If thread report option is enabled, then raw stack traces of threads inside the process will be collected as well.
  • With thread report option, your App may be paused for a few seconds till all the threads are dumped.
  • Your web app will not be restarted as a result of running the profiler.
  • A profiler trace will help to identify issues in an ASP.NET or ASP.NET Core application.

只是,查看的报告中,所以数据均无法显示,如下图:

如何来解决这个问题呢?

 

问题解答

在报告页面中打开“开发者模式”,查看Console日志或者是Networks日志,发现问题是因为 js /css 文件无法访问导致。

GET https://ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js net::ERR_CONNECTION_TIMED_OUT

因为中国区Azure所部署的位置位于北京,上海区域。所以无法正常访问 Google API,无法直接获取 angular.min.js 资源。所以可以通过修改html的 js应用路径来解决问题。

第一步:找到一个在中国区Azure可以访问的 1.2.15 版本的 angular.min.js

可以使用 https://cdn.bootcdn.net/ajax/libs/angular.js/1.2.15/angular.min.js 替换 https://ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js 

第二步:打开App Service的Kudu站点,进入DebugConsole

寻找 Data/DaaS/Reports/240701_1119225346/240701_1121184125/dw0sdwk00002D/index.html 文件,  然后编辑。 注意 “/240701_1119225346/240701_1121184125/dw0sdwk00002D/” 这部分内容会根据具体的时间,实例名发生变动。

第三步:在HTML文件种替换 angular.min.js

## 把 
 <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js"></script>
## 替换为
 <script src="https://cdn.bootcdn.net/ajax/libs/angular.js/1.2.15/angular.min.js"></script>

 

再次打开 Profiler Report 页面,加载数据成功!

 

参考资料

Angular JS: https://www.bootcdn.cn/angular.js/

Collect .NET Profiler Trace : https://appserviceblog.com/en/collect-net-profiler-trace/

App Service Diagnostics – Profiling an ASP.NET Web App on Azure App Service : https://azure.github.io/AppService/2018/06/06/App-Service-Diagnostics-Profiling-an-ASP.NET-Web-App-on-Azure-App-Service.html

 

当在复杂的环境中面临问题,格物之道需:浊而静之徐清,安以动之徐生。 云中,恰是如此!

相关文章
|
8月前
|
存储 自然语言处理 C#
.NET开源、跨平台的本地日记APP - SwashbucklerDiary
.NET开源、跨平台的本地日记APP - SwashbucklerDiary
|
2月前
|
XML Java Android开发
Android Studio App开发之服务Service的讲解及实战(包括启动和停止,绑定与解绑,推送服务到前台实现音乐播放器,附源码)
Android Studio App开发之服务Service的讲解及实战(包括启动和停止,绑定与解绑,推送服务到前台实现音乐播放器,附源码)
374 0
|
2月前
|
XML 开发框架 .NET
LabVIEW中加载.NET 2.0,3.0和3.5程序集
LabVIEW中加载.NET 2.0,3.0和3.5程序集
36 4
|
16天前
|
安全 网络安全 Windows
【Azure App Service】遇见az命令访问HTTPS App Service 时遇见SSL证书问题,暂时跳过证书检查的办法
在访问App Service的KUDU工具或使用`az webapp deploy`时遇到SSL错误:`SSL: CERTIFICATE_VERIFY_FAILED`。解决方法是临时禁用Azure CLI的SSL验证。在PowerShell中,设置`$env:ADAL_PYTHON_SSL_NO_VERIFY`和`$env:AZURE_CLI_DISABLE_CONNECTION_VERIFICATION`为1;在Windows命令提示符中,使用`set AZURE_CLI_DISABLE_CONNECTION_VERIFICATION=1`。注意,这可能引入安全风险,应仅在必要时使用。
|
14天前
|
应用服务中间件 Linux 网络安全
PHP应用部署在App Service for Linux环境中,上传文件大于1MB时,遇见了413 Request Entity Too Large 错误的解决方法
在Azure App Service for Linux上部署的PHP应用遇到上传文件超过1MB时出现413 Request Entity Too Large错误的解决之法
|
2月前
|
开发框架 .NET 开发工具
LabVIEW加载.NET程序集
LabVIEW加载.NET程序集
33 1
|
2月前
|
XML 开发框架 .NET
C#/ASP.NET应用程序配置文件app.config/web.config的增、删、改操作
C#/ASP.NET应用程序配置文件app.config/web.config的增、删、改操作
34 1
|
2月前
|
API UED
深入理解 uni-app 中的加载提示:uni.showLoading
深入理解 uni-app 中的加载提示:uni.showLoading
728 0
|
2月前
|
开发框架 前端开发 算法
【Qt App 编译 】Qt Cmake 资源文件的加载:如何使用 CMakeLists.txt 文件和资源文件
【Qt App 编译 】Qt Cmake 资源文件的加载:如何使用 CMakeLists.txt 文件和资源文件
84 0
|
2月前
Google Earth Engine APP(GEE)—— 一个简单的加载影像的UI(RGB,NDWI和NDVI)这里使用时间滑块进行时间选择
Google Earth Engine APP(GEE)—— 一个简单的加载影像的UI(RGB,NDWI和NDVI)这里使用时间滑块进行时间选择
56 0