在负载平衡的Web服务器环境中使用MiniProfiler

时间:2014-05-30 15:14:13

标签: mvc-mini-profiler

在单个Web服务器上运行迷你探查器是没有道理的,它只是工作,但是当我在基于IP的池的BIG-IP后面运行时,我在请求此资源时得到404s"结果/迷你探查器 - 资源&#34 ;.

Chrome developer tools

探查器确实会显示结果,但它们似乎非常随机,并与其他视图/页面中发生的事件混合在一起。我希望有人可能有这方面的经验,并能指出我正确的方向。

谢谢你, 斯蒂芬

相关代码

<package id="MiniProfiler" version="3.0.10" targetFramework="net45" />
<package id="MiniProfiler.MVC4" version="3.0.10" targetFramework="net45" />

配置

<system.webServer>
<modules runAllManagedModulesForAllRequests="true"></modules>
<staticContent>
  <remove fileExtension=".svg" />
  <remove fileExtension=".eot" />
  <remove fileExtension=".woff" />
  <mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
  <mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
  <mimeMap fileExtension=".woff" mimeType="application/font-woff" />
</staticContent>
<handlers>
  <add name="MiniProfiler" path="mini-profiler-resources/*" verb="*" type="System.Web.Routing.UrlRoutingModule" resourceType="Unspecified" preCondition="integratedMode" />
</handlers>
<security>
  <requestFiltering>
    <requestLimits maxQueryString="2097151" />
  </requestFiltering>
</security>
</system.webServer>

全局

protected void Application_BeginRequest()
{
    if (EnableProfiler)
    {
        MiniProfiler.Start();
    }
}

protected void Application_EndRequest()
{
    if (EnableProfiler)
    {
        MiniProfiler.Stop();                
    }
}

1 个答案:

答案 0 :(得分:3)

听起来您的问题将通过实施自定义存储提供程序或使用除默认HttpRuntimeCacheStorage之外提供的其中一种替代方案来解决。

使用的主要内置替代方法是SqlServerStorage。如果您想使用不同的数据库进行存储,请继承DatabaseStorageBase并根据您的需要实现这些功能。

如果您有兴趣创建自己的自定义存储界面,则需要实施IStorage。在这里,您可以指示如何存储和检索探查器记录(您可以选择适用于负载平衡的Web服务器环境的介质)。

您可以通过将MiniProfiler.Settings.Storage设置为所选的存储提供商来更改您正在使用的存储空间。