我正在IIS下運行帶有狀態服務器的ASP.net網站。一個對象無法序列化,但我不知道哪一個。有沒有辦法讓IIS或Visual Studio告訴我哪個對象無法序列化?哪一個對象不能被序列化?具有狀態服務器的IIS會話狀態
謝謝。
********** 12/3/2015 9:22:23 PM **********
Exception giud: 3fa14c14-cad5-48fa-a23a-7eccc3340093
Inner Exception Type: System.Web.HttpException
Inner Exception: Unable to serialize the session state. In 'StateServer' and 'SQLServer' mode, ASP.NET will serialize the session state objects, and as a result non-serializable objects or MarshalByRef objects are not permitted. The same restriction applies if similar serialization is done by the custom session state store in 'Custom' mode.
Inner Source: System.Web
Inner Stack Trace:
at System.Web.Util.AltSerialization.WriteValueToStream(Object value, BinaryWriter writer)
at System.Web.SessionState.SessionStateItemCollection.WriteValueToStreamWithAssert(Object value, BinaryWriter writer)
at System.Web.SessionState.SessionStateItemCollection.Serialize(BinaryWriter writer)
at System.Web.SessionState.SessionStateUtility.Serialize(SessionStateStoreData item, Stream stream)
at System.Web.SessionState.SessionStateUtility.SerializeStoreData(SessionStateStoreData item, Int32 initialStreamSize, Byte[]& buf, Int32& length, Boolean compressionEnabled)
at System.Web.SessionState.OutOfProcSessionStateStore.SetAndReleaseItemExclusive(HttpContext context, String id, SessionStateStoreData item, Object lockId, Boolean newItem)
at System.Web.SessionState.SessionStateModule.OnReleaseState(Object source, EventArgs eventArgs)
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Exception Type: System.Web.HttpException
Exception: Server Error: 500
Source: HttpError
Stack Trace:
你能嘗試捕獲SerializationException並將其粘貼到此處嗎?看看[這個答案](http://stackoverflow.com/questions/5889240/unable-to-serialize-the-session-state) –