私は使用していたWebアプリケーションを持っていますAsp.net MVC2。私はそれをMVC 3にアップグレードしましたが、今はOutputCacheの機能がそれ以上機能していないことがわかりました。以下に示すような単純なテストアクションを作成しました。MVC 2からアップグレードした後、Asp.net MVC 3はNinjectで動作しませんでしたか?
[OutputCache(Duration = 1000000, VaryByParam = "none")]
public virtual ActionResult CacheTest(string name)
{
string message = string.Format("{0}: Time is {1}", name, DateTime.Now.ToLongTimeString());
ViewData.Add("Message", message);
return View();
}
これは、常にそれがにキャッシュされていないことを示している現在の時刻を与えます。私はここに何かを逃していますか
詳細情報:私は新しいMvc3アプリケーションを作成すると問題なく動作します。私はこの問題があるアップグレードされたアプリケーションでのみ。
更新:私はNinjectも使用しています。 Ninjectの使用をやめると、OutputCacheが動作を開始します。
public class MvcApplication : System.Web.HttpApplication
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}.aspx/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
}
protected void Application_Start()
{
RegisterDependencyResolver();
AreaRegistration.RegisterAllAreas();
RegisterRoutes(RouteTable.Routes);
}
protected void RegisterDependencyResolver()
{
var kernel = CreateKernel();
DependencyResolver.SetResolver(new NinjectDependencyResolver(kernel));
}
protected IKernel CreateKernel()
{
return new StandardKernel();
}
}
奇妙な問題を再現できません。キャッシュは私のために働く。 –
私は新しいMvc3アプリケーションを作成してもうまく動作します。私はこの問題があるアップグレードされたアプリケーションでのみ。 – Amitabh
これは意味がありません。私にとって、このa)は再現できませんb)ちょうど意味がありません - Ninjectは 'OutputCacheAttribute'とは関係がありませんので、NinjectやMVCの複数のバージョンを持つようなものがあるはずです。 https://groups.google.com/forum/?fromgroups=#!topic/ninject/NtsBWNS4MJs –