【问题标题】:Mini Profiler does not render scriptsMini Profiler 不渲染脚本
【发布时间】:2011-10-14 18:25:10
【问题描述】:

我已经添加了 Mini ProfilerNuGet,虽然在一个非常简单的项目中工作得很好,但这是一个大型且现有的项目,当然 我得到了一些问题 :(

它将正确的脚本标签写入源代码中

<link rel="stylesheet" type="text/css" href="/mini-profiler-includes.css?v=1.9.0.0">
<script type="text/javascript">    
    if (!window.jQuery) document.write(unescape("%3Cscript src='/mini-profiler-jquery.1.6.2.js' type='text/javascript'%3E%3C/script%3E"));    
    if (!window.jQuery || !window.jQuery.tmpl) document.write(unescape("%3Cscript src='/mini-profiler-jquery.tmpl.beta1.js' type='text/javascript'%3E%3C/script%3E"));    
</script>    
<script type="text/javascript" src="/mini-profiler-includes.js?v=1.9.0.0"></script>    
<script type="text/javascript">    
    jQuery(function() {    
        MiniProfiler.init({    
            ids: ["e48fcf61-41b0-42e8-935a-fbb1965fc780","870a92db-89bc-4b28-a410-9064d6e578df","30881949-bfdb-4e3a-9ea5-6d4b73c28c1d","6bca31b8-69d9-48eb-b86e-032f4d75f646","df16838d-b569-47d0-93e6-259c03322394"],    
            path: '/',    
            version: '1.9.0.0',    
            renderPosition: 'left',    
            showTrivial: false,    
            showChildrenTime: false,    
            maxTracesToShow: 15    
        });    
    });    
</script>

但是当我尝试打开任何文件时,我得到一个 HTTP 404

我验证了App_Start下有一个MiniProfiler.cs,并在那里添加一个断点,代码运行,我什至添加了

#region Mini Profiler

protected void Application_BeginRequest()
{
    if (Request.IsLocal)
    {
        MiniProfiler.Start();
    }
}
protected void Application_EndRequest()
{
    MiniProfiler.Stop();
}

#endregion

global.asax 文件...

有没有我明显遗漏的东西?

【问题讨论】:

标签: asp.net-mvc-3 installation iis-express mvc-mini-profiler


【解决方案1】:

这是某些 IIS 配置的已知问题。

解决方法是确保 UrlRoutingModule 处理您的 web.config 中包含的所有迷你分析器:

<system.webServer>
    <handlers>
        <add name="UrlRoutingModule1" path="mini-profiler*.js" verb="*" type="System.Web.Routing.UrlRoutingModule" resourceType="Unspecified" preCondition="integratedMode" />
        <add name="UrlRoutingModule2" path="mini-profiler*.css" verb="*" type="System.Web.Routing.UrlRoutingModule" resourceType="Unspecified" preCondition="integratedMode" />
        <add name="UrlRoutingModule3" path="mini-profiler*.tmpl" verb="*" type="System.Web.Routing.UrlRoutingModule" resourceType="Unspecified" preCondition="integratedMode" />
    </handlers>
</system.webServer>

目前有 2 张关于此问题的待处理票:

在未来的版本中,为避免此问题,我们可能会提供我们的包含无扩展

【讨论】:

  • 在 IIS Express 中运行时,我在 Chrome 中看到“未捕获的 ReferenceError:“MiniProfiler”未定义”错误。此错误导致我们所有其他文档就绪脚本无法运行,从而破坏了我们的整个站点。原来是这个问题。
  • 这解决了我使用 IIS7 和默认配置的问题。谢谢!请务必检查 MiniProfiler 主页上的“疑难解答”部分。
  • 在 MVC4(Internet 模板)中,我一直在为 requires.js 获取 404,直到在 部分添加 。如果您不想使用 rullAllManagedModulesForAllRequests,请参阅此线程 stackoverflow.com/questions/10212725/… 以获取替代解决方案,我对两者都进行了测试,它们都可以正常工作。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-07-26
  • 1970-01-01
  • 2012-06-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多