0

I am storing an object in session state (using local session state server), class def is:

 [Serializable]
 public class ExtendedOAuth2Parameters : OAuth2Parameters

but the service is still reporting:

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.

[SerializationException: Type 'Google.GData.Client.OAuth2Parameters' in Assembly 'Google.GData.Client, Version=2.1.0.0, Culture=neutral, PublicKeyToken=04a59ca9b0273830' is not marked as serializable.]

How to get around it?

4

1 に答える 1

1

エラー メッセージに基づくと、基本クラス ( Google.GData.Client.OAuth2Parameters) はシリアル化できないようです。そのため、クラスを属性でマークしたとしてもSerializable、完全なクラス階層はシリアル化できません。

それ自体がシリアライズ可能なベース クラスを使用するか、コードにアクセスできる場合 (おそらくアクセスできない場合) は、Google.GData.Client.OAuth2Parametersクラスをシリアライズ可能にする必要があります。

「直列化可能性」は、特定のクラスの完全な型ツリーに依存することに注意してください。つまり、すべての基底クラスとメンバー クラスも直列化可能である必要があります。

于 2012-12-06T11:02:10.290 に答える