1

我正在尝试将MiniProfiler连接到我的ASP.NET Core MVC Web应用程序中。我没有使用实体框架,我正在使用Dapper。MiniProfiler没有出现在ASP.NET核心

sample app,这里有我的变化:

1)添加到Startup.csConfigureServices

services.AddMiniProfiler(); 

2)添加到配置的标签帮手Startup.csConfigure

app.UseMiniProfiler(new MiniProfilerOptions 
{ 
    // Path to use for profiler URLs 
    RouteBasePath = "~/profiler", 

    // Control which SQL formatter to use 
    SqlFormatter = new StackExchange.Profiling.SqlFormatters.InlineFormatter(), 

    // Control storage 
    Storage = new MemoryCacheStorage(cache, TimeSpan.FromMinutes(60)), 

    // To control which requests are profiled, use the Func<HttpRequest, bool> option: 
    ShouldProfile = request => true, 

    // Profiles are stored under a user ID, function to get it: 
    //UserIdProvider = request => MyGetUserIdFunction(request), 
}); 

3)我的_ViewImports根据样本

4)增加了标签帮助我的_Layout文件,只是body标签结束前:

<mini-profiler position="@RenderPosition.Left" max-traces="5" show-controls="true" start-hidden="false" /> 

5)确信我的控制器产生一些输出MiniProfiler:

using (MiniProfiler.Current.Step("Example step")) 
{ ... } 

尽管所有这一切,我什么也得不到。当我查看源代码时,我发现标记助手没有生成任何HTML。任何人都可以建议吗?

+2

对于任何发现此问题的人,文档(包括入门)已在此处设置:http://miniprofiler.com/dotnet/ –

回答

0

哦。尴尬。

这是我愚蠢的错。我已将标签助手添加到错误的布局文件中。

Sheesh。