相关疑难解决方法(0)

为什么我在使用Azure缓存(.NET MVC3应用程序)时无法组合[Authorize]和[OutputCache]属性?

使用Windows Azure Microsoft.Web.DistributedCache.DistributedCacheOutputCacheProvider作为MVC3应用程序的outputCache提供程序.以下是相关的操作方法:

[ActionName("sample-cached-page")]
[OutputCache(Duration = 300, VaryByCustom = "User", 
    Location = OutputCacheLocation.Server)]
[Authorize(Users = "me@mydomain.tld,another@otherdomain.tld")]
public virtual ActionResult SampleCachedPage()
{
    return View();
}
Run Code Online (Sandbox Code Playgroud)

从Web浏览器加载此视图时出现以下异常:

System.Configuration.Provider.ProviderException: When using a custom output cache provider like 'DistributedCache', only the following expiration policies and cache features are supported: file dependencies, absolute expirations, static validation callbacks and static substitution callbacks.

System.Configuration.Provider.ProviderException: When using a custom output cache provider like 'DistributedCache', only the following expiration policies and cache features are supported:  file dependencies, absolute …
Run Code Online (Sandbox Code Playgroud)

outputcache azure authorize-attribute asp.net-mvc-3

19
推荐指数
2
解决办法
6074
查看次数