Pet*_*ner 5 mvc-mini-profiler entity-framework-core miniprofiler asp.net-core
我已将以下代码添加到与实体框架配合使用的 asp.net core .net 5 应用程序中。在startup.cs中我有:
services.AddMiniProfiler(options =>
{
options.PopupRenderPosition = StackExchange.Profiling.RenderPosition.BottomLeft;
options.PopupShowTimeWithChildren = true;
options.RouteBasePath = "/profiler";
}).AddEntityFramework();
Run Code Online (Sandbox Code Playgroud)
在我的 app.useRouting 之前我有
app.UseMiniProfiler();
Run Code Online (Sandbox Code Playgroud)
我添加到一个控制器,我知道它被称为以下内容:
using System.Collections.Generic;
using System.Linq;
using EFSvcc.Models;
using Microsoft.AspNetCore.Mvc;
using StackExchange.Profiling;
namespace WebAppReactCRA.Controllers
{
[ApiController]
[Route("[controller]")]
public class WeatherForecastController : ControllerBase
{
private readonly svcodecampContext _dbContext;
public WeatherForecastController(svcodecampContext dbContext)
{
_dbContext = dbContext;
}
[HttpGet]
public List<DiscountCode> Get()
{
List<DiscountCode> discountCodes;
using (MiniProfiler.Current.Step("WeatherForecastController: Groupby Clause For Total and Sent"))
{
var z = _dbContext.DiscountCodes;
discountCodes = z.ToList();
}
return discountCodes;
}
}
}
Run Code Online (Sandbox Code Playgroud)
这是一个 SPA 应用程序,所以没有弹出窗口并不奇怪,但我似乎无法让 http://localhost:5000/profiler 工作。它只是返回“未找到”
想法?
根据这个:
https://miniprofiler.com/dotnet/AspDotNetCore
根据您对 RouteBasePath 的覆盖,您的可用路线有:
http://localhost:{port number}/profiler/results-index
http://localhost:{port number}/profiler/results
http://localhost:{port number}/profiler/results?id={guid of specific profiler}
Run Code Online (Sandbox Code Playgroud)
我不相信 /profiler 的路线实际上是公开的。
| 归档时间: |
|
| 查看次数: |
1248 次 |
| 最近记录: |