迷你探查器WCF

时间:2012-10-11 11:08:51

标签: wcf mvc-mini-profiler

我正在尝试将迷你探查器与WCF一起使用。 我一直收到404错误:

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

没有返回任何结果。

我正在使用迷你探查器的两个版本。不包含对WCF支持的NUGET版本工作正常。

我下载了git版本,以便我可以使用WCF集成。 我注意到,如果我运行源'Sample.Mvc'中包含的测试项目,则在执行主页时会发生相同的错误,但对于某些链接则不会。我似乎无法获得任何自己的网站页面的结果。发生同样的情况。

我已经下载了主版本。我正在使用.NET 4.0和studio 2010。

我在配置文件中有以下内容,我尝试过使用和不使用处理程序。

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

我肯定会调用启动和停止方法。

StackExchange.Profiling.MiniProfiler.Stop();

我读过这个:MvcMiniProfiler results request giving 404 in Asp.Net MVC app

没有用。

我找到了问题的线索

miniprofiler中的以下代码返回NotFound 分析器期望存在某种guid值,但事实并非如此。

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

临时修复

我拿出了上面的代码,刚刚从存储中收集了第一个guid,这解决了这个问题。我认为这段代码需要清理。我需要学习GIT,然后尝试自己清理它。

var id = MiniProfiler.Settings.Storage.List(10).FirstOrDefault();

1 个答案:

答案 0 :(得分:2)

你能看到... / mini-profiler-resources / results-index?

处理程序不需要btw。你的链接中有一个逗号但是假设这只是一个错误的问题。

您是否在Application_BeginRequest()中呼叫开始最后一件事并停在Application_EndRequest()

您是否设置了GlobalFilters.Filters.Add(new ProfilingActionFilter());

您使用的是带有MiniProfilerPackageMiniProfilerStartupModule

的WebActivator吗?

认为我需要整理自己的实现,因为看起来我有一些不必要的瑕疵。