2010-08-24 123 views
0

我有一個.NET 3.5 MVC2 web應用程序,它可以從Visual Studio 2008中正常運行,但是當我發佈到遠程站點時,功能。類型'Tamir.SharpSsh.jsch.JSchException'未標記爲可序列化

任何想法我應該在這裏尋找?

Event Type: Error 
Event Source: ASP.NET 2.0.50727.0 
Event Category: None 
Event ID: 1334 
Date:  24/08/2010 
Time:  13:58:55 
User:  N/A 
Computer: MSVSC01-G124NW 
Description: 
An unhandled exception occurred and the process was terminated. 

Application ID: DefaultDomain 

Process ID: 17048 

Exception: System.Runtime.Serialization.SerializationException 

Message: Type 'Tamir.SharpSsh.jsch.JSchException' in Assembly 'Tamir.SharpSSH, Version=1.1.1.13, Culture=neutral, PublicKeyToken=null' is not marked as serializable. 

StackTrace: 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.WriteObjectInfo.Serialize(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.Runtime.Remoting.Channels.CrossAppDomainSerializer.SerializeObject(Object obj, MemoryStream stm) 
    at System.AppDomain.Serialize(Object o) 
    at System.AppDomain.MarshalObject(Object o) 


For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp. 

回答

1

那麼..你的異常類是否標記爲可序列化?

+0

不,它不是,它是在一個第三方的DLL。在VS中運行時正常工作(正常情況下拋出異常),我不明白。 我已經檢查了源代碼,並且它沒有嘗試序列化異常。所以我不確定這個錯誤是如何造成的? – Pete 2010-08-24 15:27:31

0

您是否使用類另一類是可序列化的成員:關於屬性和系列化

[Serializable()]   
public class TestSimpleObject { ... } 

更多信息?如果是這樣,你可能需要將這些屬性添加到該變量

[XmlIgnore][field: NonSerialized] private JSch    _jsch 

我希望幫助

相關問題