Andriy Zakharko
Andriy Zakharko

Reputation: 1673

MiniProfiler and WebForms

So I'm trying to use MiniProfiler (https://github.com/MiniProfiler/dotnet) for WebForms website. What I did is:

  1. install package using nuget
  2. add MiniProfiler initialization in Global.asax.cs (Begin_request and End_request events)
  3. add <%= StackExchange.Profiling.MiniProfiler.RenderIncludes() %> statement

  4. set at web.comfig

And still MiniProfiler doesn't work. Simple troubleshooting shows that (in Chrome dev tools) on that page I expect to see MiniProfiler, I see

http://localhost/mycoolsite/mini-profiler-resources/results 404.0 - Not Found

More info: I use .Net FW 4.5.1, IIS8 and Intergated Mode (app pool)

Any Ideas what may be useful for me?

Upvotes: 4

Views: 1571

Answers (1)

Rob
Rob

Reputation: 45789

I've (very!) recently blogged about this, specifically the process of getting MiniProfiler working in a hybrid WebForms/MVC application.

Based on the steps that you've outlined that you carried out, it looks like you're missing (as compared to what I've got):

<%= StackExchange.Profiling.ClientTimingHelper.InitScript %>

That said, even without that line I still see server side timings and the MiniProfiler UI so I suspect that your web.config entry was/is incorrect.

Check to make sure that you've put this in configuration > system.webServer > handlers within your web.config:

<add name="MiniProfiler" path="mini-profiler-resources/*" verb="*" type="System.Web.Routing.UrlRoutingModule" resourceType="Unspecified" preCondition="integratedMode" />

There are a couple of other things that you can check as well:

  1. Does the page that you're viewing live in a sub-folder that has a web.config either in it, or in a folder between it and the one where you added the handlers entry which <clear />s handlers?
  2. Do you have anything else present in your application that could be capturing the request for MiniProfiler resources and returning a 404?

Upvotes: 10

Related Questions