我正在尝试将特定的Web部件添加到我的SharePoint网站,我收到错误
“System.Runtime.Serialization.SerializationException:输入'[MyType]' 在汇编'[MyAssembly]'中没有标记为可序列化。“
我知道通常有两个修复方法:将对象标记为可序列化或将Web应用程序的会话状态更改为"InProc"
(msdn)。我的对象具有COM对象的成员引用,因此无法进行序列化,因此我想将会话状态模式更改为InProc。站点的web.config文件指定了这个,并且它没有被machine.config覆盖。
此错误还有其他原因吗?尽管我的web.config文件指示了什么,SharePoint是否可以使用其他存储模式?有没有办法明确确定ASP.Net网站使用的存储模式?
完整堆栈跟踪是:
at System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type)
at System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context)
at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo()
at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter) at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck)
at System.Web.Util.AltSerialization.WriteValueToStream(Object value, BinaryWriter writer
)