entity-framework - 在带有 EF5 的 ASP.NET MVC 4 中使用 MiniProfiler

标签 entity-framework asp.net-mvc-4 mvc-mini-profiler

我尝试使用 EF Tracing Provider 检查生成的 SQL 语句,但现在我想使用 MiniProfiler,但看不到结果...

到目前为止我做了什么:

  • 安装包: enter image description here

  • 在 MiniProfiler.cs 中取消注释初始化

public static void PreStart()
{
    //...
    //TODO: If you are profiling EF code first try: 
    MiniProfilerEF.Initialize();
    //...
}
  • 在布局 View 中添加渲染(在关闭 body 标签之前):

    @MiniProfiler.RenderIncludes()
    

但是相对于 miniprofiler,浏览器中没有显示任何内容... 我正在使用数据库优先方法。

我错过了什么吗?

最佳答案

应在 web.config 中添加以下代码:

<system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <handlers>
      //...
    <add name="MiniProfiler" path="mini-profiler-resources/*" verb="*" type="System.Web.Routing.UrlRoutingModule" resourceType="Unspecified" preCondition="integratedMode" />
    </handlers>
  </system.webServer>

关于entity-framework - 在带有 EF5 的 ASP.NET MVC 4 中使用 MiniProfiler,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15833062/

相关文章:

c# - 每个用户一个 SQL 架构

c# - GridView 找不到定义类型的字段,但找不到匿名类型?

.net - 使用 Entity Framework 按时间戳列选择新记录

jquery - Kendo Datepicker 转换为 jQuery 发布日期值

javascript - 如何在jquery模板中使用If else条件来计算span?

asp.net-mvc - 在生产代码中保留 MiniProfiler 的 ProfiledDbConnection 是否安全?

webforms - MiniProfiler 与 ASP.NET WebForms 经典模式

c# - 运行程序后无法将类型 'System.Linq.IQueryable<System.Guid>' 转换为 'System.Guid'

asp.net - 构建asp.net mvc网站时出错

mvc-mini-profiler - MVC 迷你分析器 "duration"与 "with children"