-1
我使用Cache
从System.Web.Caching
缓存来自数据库的一些数据。当我在本地机器上运行应用程序从Visual Studio
它工作正常。缓存在生产中不起作用
但是,当我在IIS
生产运行它,我在这行得到Null pointer exception
:
cache.Insert("Postnumbers", postnumbers, dependency,
DateTime.Now.AddDays(7), Cache.NoSlidingExpiration,
CacheItemPriority.Default, PostnumberRemovedCallback);
我查cache
,postnumbers
和dependency
和它们不为空。任何人都知道什么会导致这个问题?
堆栈跟踪:
[NullReferenceException: Object reference not set to an instance of an object.]
Solvent.Model.Persistance.General.Entities.GeneralData.LoadPostnumbers() in C:\Solvent\Solvent\Solvent.Model\Persistance\General\Entities\GeneralData.cs:39
Solvent.Model.SolventInitializer.InitializeCache() in C:\Solvent\Solvent\Solvent.Model\Context\SolventInitializer.cs:153
Solvent.Model.SolventInitializer.Initialize() in C:\Solvent\Solvent\Solvent.Model\Context\SolventInitializer.cs:105
Solvent.MvcApplication.Application_Start() in C:\Solvent\Solvent\Solvent\Global.asax.cs:42
显示完整的堆栈跟踪 – haim770
@Fildor缓存,postnumbers和依赖不是null,我写道。 – Aleksa
@ haim770我只得到这个:[NullReferenceException:对象引用未设置为对象的实例。]错误消息中没有更多信息。 – Aleksa