4

I am trying to use mini profiler with WCF. I keep getting a 404 error:

http://website/mini-profiler-resources/results

There are no results being returned.

I am using two versions of the mini profiler. The NUGET version which doesn't include support for WCF works just fine.

I downloaded the git version so that I can use the WCF integration. I note that if I run the test project included in the sources 'Sample.Mvc' the same error occurs when the home page is executed, but not for some of the links. I cannot seem to get results for any of my own web site pages. The same 404 occurs.

I have downloaded the master version. I am using .NET 4.0 and studio 2010.

I have the following in the config file, I have tried with and without the handlers.

  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true" />
    <handlers>
      <add name="MiniProfiler" path="mini-profiler-resources/*" verb="*" type="System.Web.Routing.UrlRoutingModule" resourceType="Unspecified" preCondition="integratedMode" />
    </handlers>
  </system.webServer>

I am definitely calling the start and stop methods.

StackExchange.Profiling.MiniProfiler.Stop();

I have read this: MvcMiniProfiler results request giving 404 in Asp.Net MVC app

It did not help.

I have found a clue as to the problem

The following code in miniprofiler is returning NotFound The profiler is expecting some kind of guid value to be present, and it isn't.

private static string Results(HttpContext context) {

    // this guid is the MiniProfiler.Id property
    Guid id;
    if (!Guid.TryParse(context.Request["id"], out id))
       return isPopup ? NotFound(context) : NotFound(context, "text/plain", "No Guid id specified on the query string");

temporary fix

I took out the code above, and just collected the first guid out of storage, and this fixed the problem. I think this code needs cleaning up. I need to learn GIT, and then try and clean it up myself.

var id = MiniProfiler.Settings.Storage.List(10).FirstOrDefault();
Community
  • 1
  • 1
Jim
  • 14,952
  • 15
  • 80
  • 167

1 Answers1

2

Can you see .../mini-profiler-resources/results-index ?

Handler not required btw. There is a comma in your link but assume that is just a question typo.

Are you calling start last thing in the Application_BeginRequest() and stop in Application_EndRequest()

Have you set GlobalFilters.Filters.Add(new ProfilingActionFilter());?

and are you using WebActivator with a MiniProfilerPackage and MiniProfilerStartupModule

Think I need to tidy up my own implementation as looks like I have some unnecessary cruft.

dove
  • 20,469
  • 14
  • 82
  • 108
  • Hi, that's interesting. The results-index page redirects me to login. It could be an authentication problem of some kind. – Jim Oct 11 '12 at 12:36
  • I have put breakpoints into the application begin and end requests and the code is being called, I also increased the profile level to verbose. – Jim Oct 11 '12 at 12:54
  • I commented out the authentication in the web.config, and still have the problem – Jim Oct 11 '12 at 13:07
  • @Jim if I turn off authentication I get a simple view that just says 'unauthorized' – dove Oct 11 '12 at 13:17
  • @Jim i can't see results index now either (only upgraded very recently). however, the inline results display fine. for results index I keep getting redirected back to login as if i'm not authenticated. will come back to this soon. have some work to do. – dove Oct 11 '12 at 13:21
  • Hi, I have added a temporary fix to the question above. I think it makes sense to just obtain the last results and display them. The guid is getting missed in some circumstances, and displaying the last set of results makes sense to me. – Jim Oct 12 '12 at 05:52
  • I have downloaded the source, fixed it and submitted a pull request – Jim Oct 16 '12 at 16:05