13

我已经通过NuGet添加了Mini Profiler,虽然在一个非常简单的项目中效果很好,但这是一个很大的现有项目,当然我遇到了一些问题:(

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

<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

在此处输入图像描述

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

#region Mini Profiler

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

#endregion

global.asax文件...

什么明显我想念的吗?

4

1 回答 1

11

这是某些 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 张关于此问题的公开票:

在未来的版本中,为了避免这个问题,我们可能会提供我们的 include extensionless

于 2011-10-19T22:37:29.820 回答