Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我试图获得像“Session [sessionKey]”这样的会话时。该页面显示“找不到程序集 App_WebReferences.fhdzc5d6,版本=0.0.0.0,文化=中性,PublicKeyToken=null”。我调试页面,我发现当尝试查看会话密钥时,它会抛出异常“System.Runtime.Serialization.SerializationException”。我不知道这是为什么。请帮助我,谢谢!
如果您使用 StateServer 作为会话提供者或任何其他 outproc 会话提供者,则需要将所有类标记为“Serializable”,您在会话中设置其对象。
假设您有一个名为“UserIdentity”的类,并且您在会话中存储 UserIdentity 的对象,那么您需要将该类标记为“Serializable”:
[Serializable] public class UserIdentity { // }
希望这可以帮助。