MVC-Mini-Profiler - Web Forms - 'MiniProfiler' is undefined
Asked Answered
C

1

6

I tired to install the MiniProfiler, using the HowTo on http://miniprofiler.com/

This seems to work:

<%= StackExchange.Profiling.MiniProfiler.RenderIncludes() %>

But when I start the site, I get this error message:

'MiniProfiler' is undefined

The problem is in the included MiniProfiler code:

 var initMp = function(){
                load('/mini-profiler-resources/includes.js?v=6cJT7lsVkH6SxAlFpQstk1/AgtUwMUApXN3pviVvaRE=',function(){
                    MiniProfiler.init({.....

When I try open http://localhost/mini-profiler-resources/includes.js?v=6cJT7lsVkH6SxAlFpQstk1/AgtUwMUApXN3pviVvaRE= with IE I get an 404.

I even tried this Solution found on stackoverflow but it did not work for me :(

Does anybody know this problem, or know what I can do to fix that?

SOLUTION

I solved the problem by adding the config section from this solution and the "runAllManagedModulesForAllRequests" line:

<system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <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>

The "trick" was to add the line below to get the handlers to work.

<modules runAllManagedModulesForAllRequests="true"/>
Cherish answered 16/7, 2012 at 13:32 Comment(8)
Are you using any kind of url-rewriting? Isapirewrite maybe?Tablecloth
No. We are just using basic asp.net, no fancy frameworks and stuff.Cherish
I see that it's loading up "localhost". Are you using IIS Express? or a local instance of IIS 7?Tablecloth
I am using a local instance of IIS 7Cherish
Have you seen this? code.google.com/p/mvc-mini-profiler/issues/detail?id=50#c7Tablecloth
I tried this link they provide the same soltution. But this did not work for me. Adding folders with the scripts looks like a dirty solution ;)Cherish
Dirty yes. Does it work? Yes. :) Otherwise wait for Sam Saffron to see this post.Tablecloth
Doesn't runAllManagedModulesForAllRequests="true" have a lot of overhead?Jeuz
D
3

You should be able to avoid this issue a bit more concisely (one handler line instead of three) by adding the following to your main web.config file:

<system.webServer>
  ...
  <handlers>
    <add name="MiniProfiler" path="mini-profiler-resources/*" verb="*" type="System.Web.Routing.UrlRoutingModule" resourceType="Unspecified" preCondition="integratedMode" />
  </handlers>
</system.webServer>
Diocletian answered 15/2, 2014 at 20:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.