ASP.NET MVC 3 OutputCache 路由:1 个操作的 2 个路由生成 2 个缓存页面
“outputcache 正在缓存 2 个页面(有 2 个 URL),仅用于 1 个相同的操作” 为什么 ?? 我认为输出缓存正在寻找路由数据值...,不是吗?
所以, 在我的网站上,我的主页有 2 个 URL:
“http://www.domain.com/”
和
“http://www.domain.com/search/mysearchpage.htm”
以下是路线:
routes.MapRoute(
"nameofmyroute",
"search/mysearchpage.htm",
new { controller = "Search", action = "do", id = "" },
new { controller = @"[^\.]*" }
);
routes.MapRoute("Default",
"{controller}/{action}/{id}",
new { controller = "Search", action = "do", id = "" },
new { controller = @"[^\.]*" }
);
这里是我的缓存配置:
<add name="defaultcache"
duration="3600"
enabled="true"
location="ServerAndClient" />
当我请求“/”url =>我的操作正在触发并且所有操作都已完成。 当我再次询问“/”=>时我的行动没有被解雇=>很酷,它正在工作!它是从缓存中获取的。
但: 当我询问“/search/mysearchpage.htm”=>我的行动也被解雇了! 我不明白为什么...
PS:我的操作上没有参数。
你对此有什么解释吗? 多谢 ! :)
对不起我的英语。
"The outputcache is caching 2 pages (there's 2 URLs) for just 1 same action"
WHY ??
I tought outputcache was looking for routedata values..., no?
So,
On my website, i have 2 URLs for the Home page :
"http://www.domain.com/"
and
"http://www.domain.com/search/mysearchpage.htm"
Here are the routes :
routes.MapRoute(
"nameofmyroute",
"search/mysearchpage.htm",
new { controller = "Search", action = "do", id = "" },
new { controller = @"[^\.]*" }
);
routes.MapRoute("Default",
"{controller}/{action}/{id}",
new { controller = "Search", action = "do", id = "" },
new { controller = @"[^\.]*" }
);
Here is my caching config:
<add name="defaultcache"
duration="3600"
enabled="true"
location="ServerAndClient" />
When i ask for "/" url =>my action is firing and the all the action is done.
When i re-ask for "/" => my action is not fired => cool it's working ! it's taken from the cache.
But:
When i ask for "/search/mysearchpage.htm" => my action is also fired !
I don't understand why...
PS:There's no parameter on my Action.
Do you have an explanation for that ?
Thanks a lot ! :)
Sorry for my english.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ASP.NET Outputcache 提供程序基于 Url 而不是您的路由。
ASP.NET Outputcache provider is based on Url and not your routing.