System.Runtime.Serialization.SerializationException:找不到成员'LastUpdated'

时间:2014-07-02 00:59:03

标签: c# asp.net kentico

我刚刚将Kentico CMS升级到最新的修补程序。推送到prod服务器后,我在两台服务器上都收到以下错误。

有没有其他人解决过这个错误?我认为这必须对缓存做一些事情,但我不能在这里指出问题。

我们正在使用

  • 用于会话状态的SQL服务器。
  • 两个服务器都是虚拟机
  • 两台服务器都是最新的 - 补丁等

现在kentico建议在两台服务器上重新安装.net,因为他们认为这是与环境有关的问题。

Elmah选择此错误并将其发送给我。该网站通过此错误显示正常。

System.Runtime.Serialization.SerializationException: Member 'LastUpdated' was not found.
Generated: Tue, 01 Jul 2014 23:11:07 GMT

System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.Serialization.SerializationException: Member 'LastUpdated' was not found.
   at System.Runtime.Serialization.SerializationInfo.GetElement(String name, Type& foundType)
   at System.Runtime.Serialization.SerializationInfo.GetValue(String name, Type type)
   at CMS.SettingsProvider.BaseInfo..ctor(SerializationInfo info, StreamingContext context, TypeInfo[] typeInfos)
   at CMS.DataEngine.AbstractInfo`1..ctor(SerializationInfo info, StreamingContext context, TypeInfo[] typeInfos)
   at CMS.SiteProvider.UserInfo..ctor(SerializationInfo info, StreamingContext context)
   at CMS.CMSHelper.CurrentUserInfo..ctor(SerializationInfo info, StreamingContext context)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.SerializationInvoke(IRuntimeMethodInfo method, Object target, SerializationInfo info, StreamingContext& context)
   at System.Runtime.Serialization.ObjectManager.CompleteISerializableObject(Object obj, SerializationInfo info, StreamingContext context)
   at System.Runtime.Serialization.ObjectManager.FixupSpecialObject(ObjectHolder holder)
   at System.Runtime.Serialization.ObjectManager.DoFixups()
   at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
   at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
   at System.Web.Util.AltSerialization.ReadValueFromStream(BinaryReader reader)
   at System.Web.SessionState.SessionStateItemCollection.ReadValueFromStreamWithAssert()
   at System.Web.SessionState.SessionStateItemCollection.DeserializeItem(String name, Boolean check)
   at System.Web.SessionState.SessionStateItemCollection.get_Item(String name)
   at System.Web.SessionState.HttpSessionStateContainer.get_Item(String name)
   at CMS.GlobalHelper.SessionHelper.GetValue(String key)
   at CMS.CMSHelper.ContextData.GetCurrentUser(Boolean& loadUserData, Boolean cacheResult)
   at CMS.CMSHelper.ContextData.get_CurrentUser()
   at CMS.UIControls.DocumentBase.get_CurrentUser()
   at CMS.UIControls.DocumentBase.SetCulture()
   at CMS.UIControls.DocumentBase.PreInit()
   at CMS.UIControls.ContentPage.OnPreInit(EventArgs e)
   at CMSPages_PortalTemplate.OnPreInit(EventArgs e) in d:\inetpub\NrccuaWeb\Cms20140701-KU\CMSPages\PortalTemplate.aspx.cs:line 142
   at System.Web.UI.Page.PerformPreInit()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.HandleError(Exception e)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest()
   at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
   at System.Web.UI.Page.ProcessRequest(HttpContext context)
   at ASP.cmspages_portaltemplate_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\cms\3bfbd4f3\28ac498a\App_Web_portaltemplate.aspx.67ab7734.p3gr9fmc.0.cs:line 0
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

感谢。

1 个答案:

答案 0 :(得分:0)

有点老问题但是因为我刚刚遇到这个问题所以我会为下一个人发布解决方案。

当您使用SQL Server存储会话状态时,可能会发生这种情况。

Kentico将userinfo对象存储在会话中,因此在升级之前的某个时间,您已登录到kentico站点,并且userinfo对象被序列化为SQL Server会话数据库。

在您访问站点时升级后,会话数据库中保存的userinfo对象被反序列化,因为升级后该对象被更改,因此引发了序列化异常。

您可以等待会话过期,清除会话cookie,或者如果要避免站点的任何用户出现此问题,请清除SQL Server会话数据库中的ASPStateTempSessions表。

只有在默认的inProc会话状态下才会发生这种情况,因为升级完成后网站会重新启动它。