迷你探查不会呈现脚本 [英] Mini Profiler does not render scripts

查看:213
本文介绍了迷你探查不会呈现脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我添加迷你探查通过的中的http:/ /nuget.org/List/Packages/MiniProfiler\">NuGet 以及虽然一个非常简单的项目可爱的作品,这是一个大的和现有的项目,当然是的我M得到一些问题与它:(

它写在源$ C ​​$ C正确的脚本标记为

 <链接rel =stylesheet属性类型=文/ CSS的href =?/迷你探查-includes.css V = 1.9.0.0>
<脚本类型=文/ JavaScript的>
    如果(!window.jQuery)的document.write(UNESCAPE(%3Cscript的src ='/迷你探查-jquery.1.6.2.js类型=文/ JavaScript的%3E%3C / SCRIPT%3E)) ;
    如果(!window.jQuery ||!window.jQuery.tmpl)的document.write(UNESCAPE(%3Cscript的src ='/迷你探查-jquery.tmpl.beta1.js类型=文/ JavaScript的'%3E% 3C / SCRIPT%3E));
< / SCRIPT>
<脚本类型=文/ JavaScript的SRC =/迷你探查-includes.js V = 1.9.0.0?>< / SCRIPT>
<脚本类型=文/ JavaScript的>
    jQuery的(函数(){
        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\"],
            路径:'/',
            版本:1.9.0.0,
            renderPosition:'左',
            showTrivial:假的,
            showChildrenTime:假的,
            maxTracesToShow:15
        });
    });
< / SCRIPT>

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

我证实,有一个 MiniProfiler.cs App_Start 并添加一个破发点出现,在code运行后,我甚至增加

 #区域迷你探查保护无效的Application_BeginRequest()
{
    如果(Request.IsLocal)
    {
        MiniProfiler.Start();
    }
}
保护无效Application_EndRequest()
{
    MiniProfiler.Stop();
}#endregion

的Global.asax 文件...


  

的东西显然是我失踪?



解决方案

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

解决方法是确保UrlRoutingModule处理所有的小探查器包括在你的的web.config

 < system.webServer>
    <&处理GT;
        <添加名称=UrlRoutingModule1路径=迷你分析器的* .js动词=*TYPE =System.Web.Routing.UrlRoutingModule= resourceType为未指定preCondition =integratedMode/>
        <添加名称=UrlRoutingModule2路径=迷你探查*的.css动词=*TYPE =System.Web.Routing.UrlRoutingModule= resourceType为未指定preCondition =integratedMode/>
        <添加名称=UrlRoutingModule3路径=迷你探查* .tmpl动词=*TYPE =System.Web.Routing.UrlRoutingModule= resourceType为未指定preCondition =integratedMode/>
    < /处理器>
< /system.webServer>

有目前在这个问题上2个开放门票:

在未来的版本中,为了避免这个问题,我们可能会为我们的包含的扩展名的。

I've added Mini Profiler through NuGet and though in a really simple project works lovely, this is a big and existing project, and of course that I'm getting some problems with it :(

it writes the correct script tags in the source code as

<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>

But when I try to open any file, I get a HTTP 404

I verified that there is a MiniProfiler.cs under App_Start and adding a break point there, the code runs, I even added

#region Mini Profiler

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

#endregion

to the global.asax file...

Is there something obviously that I'm missing?

解决方案

This is a known issue with certain configurations of IIS.

The workaround is to ensure the UrlRoutingModule handles all the mini profiler includes in your 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>

There are 2 open tickets on this issue at the moment:

In a future version, to avoid the issue, we will probably serve our includes extensionless.

这篇关于迷你探查不会呈现脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆