序列化和反序列化的问题...... [英] problem with serialize and deserialize...

查看:126
本文介绍了序列化和反序列化的问题......的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个程序,它序列化一个对象并发送到服务器

当我想反序列化这个对象时:



System.Runtime。 Serialization.SerializationException:无法在System.Runtime.Serialization.Formatters.Binary.BinaryAssemblyInfo.GetAssembly()中找到程序集'K1Client,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = null'。



在System.Runtime.Serialization.Formatters.Binary.ObjectReader.GetType(BinaryAssemblyInfo assemblyInfo,String name)

在System.Runtime.Serialization.Formatters.Binary.BinaryConverter。 TypeFromInfo(BinaryTypeEnum binaryTypeEnum,Object typeInformation,ObjectReader objectReader,BinaryAssemblyInfo assemblyInfo,InternalPrimitiveTypeE&primitiveTypeEnum,String&typeString,Type&type,Boolean&isVariant)

at System.Runtime.Serialization.Formatters.Binary .__ BinaryParser.ReadArray(BinaryHeaderEnum) binaryHeaderEnum)
System.Runtime.Serialization.Formatters.Bi上的
Nary .__ BinaryParser.Run()

在System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler,__BinaryParser serParser,Boolean fCheck,Boolean isCrossAppDomain,IMethodCallMessage methodCallMessage)

在System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream,HeaderHandler handler,Boolean fCheck,Boolean isCrossAppDomain,IMethodCallMessage methodCallMessage)

在System.Runtime.Serialization.Formatters。 Binary.BinaryFormatter.Deserialize(Stream serializationStream)

在K1Server.Form1.ReceivedData(IAsyncResult iar)中的e:\Projects \Programming\K1 \K1Server \K1Server \Form1.cs :第71行



请帮助我......

解决方案

问题是在您的项目中找不到所需的程序集。在Exception的第一行中,清楚地说明,找不到反序列化所需的程序集(可以说是.dll库或包)。您是否在项目中包含了该包?包含(或重新检查)它,错误将消失,因为问题是加载或使用包文件。


但我不使用程序集或DLL文件...

i create a program which serialize a object and send to server
when i want deserialize this object :

System.Runtime.Serialization.SerializationException: Unable to find assembly 'K1Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
at System.Runtime.Serialization.Formatters.Binary.BinaryAssemblyInfo.GetAssembly()
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.GetType(BinaryAssemblyInfo assemblyInfo, String name)
at System.Runtime.Serialization.Formatters.Binary.BinaryConverter.TypeFromInfo(BinaryTypeEnum binaryTypeEnum, Object typeInformation, ObjectReader objectReader, BinaryAssemblyInfo assemblyInfo, InternalPrimitiveTypeE& primitiveTypeEnum, String& typeString, Type& type, Boolean& isVariant)
at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadArray(BinaryHeaderEnum binaryHeaderEnum)
at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream)
at K1Server.Form1.ReceivedData(IAsyncResult iar) in e:\Projects\Programming\K1\K1Server\K1Server\Form1.cs:line 71

please please please help me......

解决方案

The problem is that the required assembly is not found in your project. In the first line of the Exception, it is stated clearly, that the assembly (you can say, the .dll library or the package) required to deserialize, is not found. Did you include that package inside your project? Include (or re-check) it, the error will go away because the problem is with loading or using the package file.


but i dont use assembly or dll file...


这篇关于序列化和反序列化的问题......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆