Mini Profiler does not render scripts
Asked Answered
M

1

13

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

enter image description here

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?

Moody answered 14/10, 2011 at 18:25 Comment(3)
my guess is an iis issue, which version are you running?Touslesmois
SQL Express 7.5 from Visual Studio 2010 Ultimate versionMoody
have you seen code.google.com/p/mvc-mini-profiler/issues/detail?id=50 and code.google.com/p/mvc-mini-profiler/issues/detail?id=60 ?Touslesmois
T
11

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.

Touslesmois answered 19/10, 2011 at 22:37 Comment(3)
I was seeing "Uncaught ReferenceError: "MiniProfiler" is not defined" errors in Chrome when running in IIS Express. This error was causing all of our other document ready scripts to not run, breaking our entire site. This turned out to be the issue.Nattie
This solved the problem for me using IIS7 and a default config. Thank you! Be sure to also check the "Troubleshooting" section on the homepage of MiniProfiler.Polivy
In MVC4 (Internet template) I kept getting the 404 for requires.js till I added <modules runAllManagedModulesForAllRequests="true" /> in the <system.webServer> section. If you don't want to rullAllManagedModulesForAllRequests refer to this thread #10213225 for an alternate solution, I tested both and they work fine.Walling

© 2022 - 2024 — McMap. All rights reserved.