Search code examples
wcfmvc-mini-profiler

mini profiler WCF


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();

Solution

  • 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.