Popular blog tags

NopCommerce 4.x-Profiling your nopCommerce website with MiniProfiler

Published

In this article we will learn about profiling your nopCommerce website with MiniProfiler. Out of the box, nopCommerce comes with MiniProfiler integration. So, in order to start using it, all we need to do is configure it correctly from the administration section. This out of the box integration is quite handy for many developers to see what is causing delay in loading pages.

Introduction

MiniProfiler

MiniProfiler is a simple but effective library available for profiling  websites which help developers to monitor the performance of the web application. Any developer can easily improve the performance of a website by using MiniProfiler library that shows exactly how long it takes for a webpage to load, how long it takes for a SQL query to run and all the other actions that are being executed on a web page on run-time.

The MiniProfiler library is developed by the StackExchange team.

A simple but effective mini-profiler for .NET, Ruby, Go and Node.js.

office web site:https://miniprofiler.com/

Overview

MiniProfiler for .NET supports both .NET Full Framework and .NET Core.

office web site for asp .net core:https://miniprofiler.com/dotnet/AspDotNetCore

 The project lives on GitHub:https://github.com/MiniProfiler/dotnet

 documentation and getting started:https://miniprofiler.com/dotnet/

  Documentation for ASP.NET Core:   https://miniprofiler.com/dotnet/AspDotNetCore

  Sample for  ASP.NET Core:https://github.com/MiniProfiler/dotnet/tree/main/samples/Samples.AspNetCore3

MiniProfiler.AspNetCore - The core functionality (for .NET Standard applications)
MiniProfiler.AspNetCore.Mvc - ASP.NET Core MVC Integration

Install-Package MiniProfiler.Providers.MongoDB -Version 4.2.1

 

Step 1:NuGet Packages

Install the NuGet Package: MiniProfiler.AspNetCore.Mvc.To install MiniProfiler, run the following command in the Package Manager Console:

// 主要是用于监控WebApi
Install-Package MiniProfiler.AspNetCore.Mvc
// 用于监控EntityFrameworkCore
Install-Package MiniProfiler.EntityFrameworkCore

Step 2: Setup MiniProfiler

Edit your Startup.cs to add the middleware

ConfigureServices

option 1:

services.AddMiniProfiler().AddEntityFramework();

option 2:Configure MiniProfiler with the options you want

services.AddMiniProfiler(configureOptions: options =>

            {

                options.PopupRenderPosition = RenderPosition.Right;

                options.PopupShowTimeWithChildren = true;

            }).AddEntityFramework(); // 添加MiniProfiler.EntityFrameworkCore  NuGet-----MiniProfiler.EntityFrameworkCore

 Configure 

app.UseMiniProfiler();

Add Tag Helpers in _ViewImports.cshtml

_ViewImports.cshtml

@using StackExchange.Profiling
@addTagHelper *, MiniProfiler.AspNetCore.Mvc

Add MiniProfiler to your view layout (Shared/_Layout.cshtml by default)

Shared/_Layout.cshtml

<mini-profiler />

Step 3: profile code

 

 

.Net Core使用 MiniProfiler 进行性能分析

https://www.cnblogs.com/xwgli/p/12495568.html

 

Profiling your nopCommerce 3.x website with MiniProfiler

https://www.dotnetfunda.com/articles/show/3293/profiling-your-nopcommerce-website-with-miniprofiler