This article is a mirror article of machine translation, please click here to jump to the original article.

View: 40264|Reply: 1

[.NET Core] View app status and statistics ASP.NET Core

[Copy link]
Posted on 2021-1-25 16:58:02 | | | |
In daily development, we need to pay attention to the resource usage of .NET applications to troubleshoot problems and expand capacity.

CLRStats plug-in, a plug-in that counts the resource usage of .NET applications, including: CPU usage, GC, thread status, support to obtain status information through web requests (access path and authentication can be customized), and the data will be returned in JSON format.

GitHub address:The hyperlink login is visible.

In the tank:.NET Framework >= 4.5and.NET Core >= 2.0Frame

Obtain statistics through Ajax requests, displayed in a chart as shown below:




Installation

Taking the asp.net Core 3.1 project as an example, you can use Nuget to install it with the following command:

Install-Package CLRStats

In the Startup class Configure method, add the following configuration:

app. UseCLRStatsDashboard();
After starting a project, you can view resource statistics by visiting the /clr directory of the website.

As shown below:



Advanced configuration

Custom access paths are supported, and the code is as follows:

To add the identity authentication function, identity authentication needs to inherit the IDashboardAuthorizationFilter class, and implement the Authorize method in it, the code is as follows:

To customize the access path and add authentication, in the Startup class Configure method, add the following configuration:

After the configuration is completed, enable the project, access the site /custom-link path, and the request header needs to carry the token parameter with the value of :test to access successfully.

Use the curl tool below on Windows to test with the following command:


As shown below:



Reference links:The hyperlink login is visible.




Previous:Encrypt data with ASP.NET machineKey
Next:ASP.NET Core Link Tracing (4) Access to Jaeger link tracing
Posted on 2021-9-22 20:38:12 |
Learning to learn,
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com