gpt4 book ai didi

asp.net-mvc-4 - DevTrends.MvcDonutCaching.KeyGenerator.GenerateKey 中的 NullReferenceException

转载 作者:行者123 更新时间:2023-12-03 17:46:20 32 4
gpt4 key购买 nike

我遇到了@Aviv 在这篇文章中描述的问题:
http://www.devtrends.co.uk/blog/donut-output-caching-in-asp.net-mvc-3#125

我在这里和 Codeplex 上查找错误但没有找到。

环境是中等信任!

路线

public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute("{*favicon}", new { favicon = @"(.*/)?favicon.ico(/.*)?" });
routes.IgnoreRoute("elmah.axd");

routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional }, // Parameter defaults
new[] { "LetsGo.Controllers" }
);
}

Controller
[DonutOutputCache(CacheProfile = "StaticPage")]
public ActionResult Index()
{
return View(_themeParty.Repository.Query().Published(true).ToList());
}

[ChildActionOnly]
[DonutOutputCache(CacheProfile = "DataCache")]
public PartialViewResult Subsidiaries() { return PartialView(_subsidiaries.Repository.Query().Published().ToList()); }

网页配置
<caching>
<outputCacheSettings>
<outputCacheProfiles>
<add name="DataCache" enabled="true" duration="10800" varyByParam="*" />
<add name="StaticPage" enabled="true" duration="21600" varyByParam="*" />
<add name="ByHeader" enabled="true" duration="300" varyByHeader="*" />
</outputCacheProfiles>
</outputCacheSettings>
</caching>

_Layout.cshtml
...
@Html.Action("Subsidiaries", "Home", new { area = "" })
...

完全错误
Server Error in '/LetsGo' Application.

Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
DevTrends.MvcDonutCaching.KeyGenerator.GenerateKey(ControllerContext context, CacheSettings cacheSettings) +777
DevTrends.MvcDonutCaching.DonutOutputCacheAttribute.ExecuteCallback(ControllerContext context, Boolean hasErrors) +43
System.Web.Mvc.ControllerActionInvoker.InvokeExceptionFilters(ControllerContext controllerContext, IList`1 filters, Exception exception) +168
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +652
System.Web.Mvc.Controller.ExecuteCore() +161
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +304
System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +61
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +19
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +461
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +370

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272

最佳答案

关于asp.net-mvc-4 - DevTrends.MvcDonutCaching.KeyGenerator.GenerateKey 中的 NullReferenceException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9296605/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com