0

I installed MiniProfiler.Mvc5 nuget and put in the followings:

web.config:

  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
  </system.webServer>

RegisterGlobalFilters:

filters.Add(new StackExchange.Profiling.Mvc.ProfilingActionFilter());

Global.asax.cs

void Application_Start()
{
    MiniProfiler.Configure(new MiniProfilerOptions
    {
        RouteBasePath = "~/profiler",
    }
    .ExcludeType("SessionFactory")
    .ExcludeMethod("Flush")
    .AddViewProfiling());

    AreaRegistration.RegisterAllAreas();
    FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
    System.Web.Http.GlobalConfiguration.Configure(WebApiConfig.Register);
    RouteConfig.RegisterRoutes(RouteTable.Routes);
    BundleConfig.RegisterBundles(BundleTable.Bundles);
}
void Application_BeginRequest()
{
    MiniProfiler.StartNew();
}
void Application_End()
{
    MiniProfiler.Current?.Stop();
}

_Layout.cshtml

@MiniProfiler.Current.RenderIncludes()
</body>\

rendered html:

<script async="async" id="mini-profiler" src="/profiler/includes.min.js?v=4.1.0+c940f0f28d" data-version="4.1.0+c940f0f28d" data-path="/profiler/" data-current-id="b0ff50dd-5d1d-4fc2-8bac-50d8f316fb03" data-ids="b0ff50dd-5d1d-4fc2-8bac-50d8f316fb03" data-position="Left" data-authorized="true" data-max-traces="15" data-toggle-shortcut="Alt+P" data-trivial-milliseconds="2.0" data-ignored-duplicate-execute-types="Open,OpenAsync,Close,CloseAsync"></script>

Get 404 not found on http://localhost:64755/profiler/includes.min.js?v=4.1.0+c940f0f28d

Ray Cheng
  • 12,230
  • 14
  • 74
  • 137

2 Answers2

0

Add this handlers tag in your web.config under system.webServer:

<handlers>
    <add name="MiniProfiler" path="profiler/*" verb="*" type="System.Web.Routing.UrlRoutingModule" resourceType="Unspecified" preCondition="integratedMode" />
</handlers>
itsMasoud
  • 1,335
  • 2
  • 9
  • 25
  • Are you using any tools that it needs to add its own handler to your config file? – itsMasoud Nov 07 '19 at 21:04
  • 1
    Or it might be it's because of your global filters: `FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);`. Did you tried without it? – itsMasoud Nov 07 '19 at 21:07
0

I switched to use Glimpse instead. It's much easier to setup. Just...

  1. install Glimpse.Mvc5 nuget
  2. browse to http://localhost:port/Glimpse.axd to configure the rest.
  3. done
Ray Cheng
  • 12,230
  • 14
  • 74
  • 137