나는 소켓으로의 HttpWebRequest를 보내려고하고 나는 그것을 직렬화 할 때, 나는이 예외가 형식 'System.Runtime.Serialization.SerializationException'의 처리되지 않은 예외가 mscorlib에 발생 직렬화 HttpWebRequest를
. dll 추가 정보 : 어셈블리 'System, Version = 4.0.0.0, Culture = neutral, PublicKeyToken = b77a5c561934e089'의 'System.Net.WebRequest + WebProxyWrapper'형식이 serializable로 표시되어 있지 않습니다. 내가 직렬화 나의 클래스를 설정하고()하지만이 작동하지 않는abstract class Serializ { #region Filds static MemoryStream ms = null; static BinaryFormatter formatter = null; #endregion #region Methods public static byte [] seryaliz(object obj) { ms = new MemoryStream(); formatter = new BinaryFormatter(); formatter.Serialize(ms, obj); ms.Position = 0; String tmp = null; StreamReader sr = new StreamReader(ms); tmp = sr.ReadToEnd(); ms.Position = 0; sr.Close(); ms.Close(); return Encoding.ASCII.GetBytes(tmp); } public static object DEseryaliz(byte [] Data) { object obj = new object(); formatter = new BinaryFormatter(); ms = new MemoryStream(Data); ms.Position = 0; obj=(object)formatter.Deserialize(ms); ms.Close(); return obj; } #endregion }
:
[Serializable()] class BROWSER { HttpListener Response = null; HttpListenerContext context = null; HttpListenerRequest request = null; HttpListenerResponse response = null; public HttpWebRequest Webrequest = null; public WebResponse Webresponce = null; string responseString = null; //when my Webrequest is ready ... public void SendToProxyServer(HttpWebRequest Webrequest) { byte[] SndData; S_RSocket sock = new S_RSocket(); SndData = Serializ.seryaliz(this.Webrequest); sock.Send(SndData); this.responseString = sock.res; }
내 직렬화 클래스 :
이
내 코드입니다.어디에 문제가 있습니까?