ASP.NET MVC的OutputCache没有根URI工作 [英] ASP.NET MVC OutputCache doesn't work for root URI

查看:162
本文介绍了ASP.NET MVC的OutputCache没有根URI工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我学习ASP.NET MVC和一个问题窃听。

I'm learning ASP.NET MVC and bugged by one issue.

在HomeController中,索引动作有,OutputCache属性,但似乎不起作用。

In the HomeController, the Index action has OutputCache attribute, but it seems doesn't work.

[HandleError]
public class HomeController : Controller
{
    [OutputCache(Duration=5, VaryByParam="none")]
    public ActionResult Index()
    {
        ViewData["Title"] = "Home Page" + DateTime.Now;
        ViewData["Message"] = "Welcome to ASP.NET MVC! " + DateTime.Now;

        return View();
    }
}

颇有几分努力后,我发现,这是因为我访问操作的方式。如果我通过访问它的http://本地主机:3573 /,在的OutputCache不起作用。但是,如果我访问它的http://本地主机:3575 /首页/索引中,作品的OutputCache

After quite a few minutes trying, I found that it is due to the way I access the action. If I access it through "http://localhost:3573/", the outputcache doesn't work. However, if I access it with "http://localhost:3575/Home/Index", the outputcache works.

有人知道任何解决方法,以使默认的控制器行动outputcacheable?

Anybody know any workaround to make the default controller-action outputcacheable?

感谢。

推荐答案

我觉得这是在ASP.NET MVC中的错误。我们已记录该问题在我们的数据库中,并会探讨这个问题的修复程序。

I think this is a bug in ASP.NET MVC. We have logged the issue in our database and will investigate a fix for this issue.

谢谢,
Eilon

Thanks, Eilon

这篇关于ASP.NET MVC的OutputCache没有根URI工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆