【问题标题】:GetVaryByCustomString method is not called未调用 GetVaryByCustomString 方法
【发布时间】:2015-03-25 10:39:33
【问题描述】:

生产服务器出现问题。在本地和测试服务器上,不会重现此问题。

.NET 4.5,Sitecore 7.2。

几个用户控件具有以下指令:

<%@ OutputCache VaryByParam="*"  Duration="300" VaryByCustom="VaryByUrl" %>

注意:相应的站点核心子布局已关闭缓存。

Global.asax 中的方法:

    public override string GetVaryByCustomString(HttpContext context, string custom)
    {
        switch (custom.ToLower())
        {
            case "varybyurl":
                return context.Request.Url.DnsSafeHost + context.Request.RawUrl + OutputCacheKey;
        }

        return base.GetVaryByCustomString(context, custom);
    }

之前的缓存工作正常。但从最近开始,它突然坏了(但只在实时服务器上)。它的行为:

  • 带有用户控件(已提及指令)的第 1 页加载了一些信息(例如“文本 A”)。
  • 然后我打开另一个页面 #2,该页面具有相同的控件,但具有另一个数据(应具有“文本 B”),但此页面上的此控件上显示了“文本 A”。
  • 仅在 300 秒后,刷新第 2 页后,显示“文本 B”。
  • 我试图将日志记录添加到 GetVaryByCustomString 中,但在实时服务器上未收到任何日志,因此这意味着该方法未被调用。

也许有人知道为什么它会以这种方式工作? 谢谢!

【问题讨论】:

    标签: c# asp.net sitecore outputcache


    【解决方案1】:

    问题原因找到了!

    Global.asax 文件在实时服务器上不存在。

    由于某种原因,它在上次构建期间没有交付。

    当前问题可以关闭:)

    【讨论】:

      猜你喜欢
      • 2015-01-31
      • 1970-01-01
      • 1970-01-01
      • 2014-03-04
      • 2019-09-01
      • 2015-10-15
      • 2014-06-26
      • 2020-01-12
      • 2020-10-05
      相关资源
      最近更新 更多