工作流程4持久性,反序列化错误

编程入门 行业动态 更新时间:2024-10-12 10:25:56
本文介绍了工作流程4持久性,反序列化错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

大家好 我有一个WF4活动,我已成功将其持久保存到Sql数据库,但是当尝试加载以前保存的实例时,我收到以下异常: 反序列化程序无法加载要反序列化的类型,因为在程序集中找不到类型"System.Activities.Location`1 [[MYTYPE,MYASSEMBLY,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = null]]" System.Activities,版本= 4.0.0.0,文化=中性,PublicKeyToken = 31bf3856ad364e35''.检查要序列化的类型与要反序列化的类型具有相同的协定,并使用相同的程序集. "MYTYPE"类是MYASSEMBLY中包含的POCO. 感谢收到的任何帮助, 谢谢

Hi all I have a WF4 activity which I am successfully persisting to an Sql database, however when attempting to load the previously persisted instance I receive the following exception: The deserializer cannot load the type to deserialize because type ''System.Activities.Location`1[[MYTYPE, MYASSEMBLY, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]'' could not be found in assembly ''System.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35''. Check that the type being serialized has the same contract as the type being deserialized and the same assembly is used. The "MYTYPE" class is a POCO contained within MYASSEMBLY. Any help gratefully received, Thanks

推荐答案

水合过程需要找到您的装配体,而找不到.最简单的方法是对程序集进行签名,然后将其放入GAC中. 如果您喜欢冒险,可以处理AssemblyResolve事件并像这样自己加载程序集: The hydration process needs to find your assembly and can''t. The easiest thing to do is sign your assembly and put it in the GAC. If you are adventurous you can handle the AssemblyResolve event and load assemblies yourself like this : private Assembly AppDomain_AssemblyResolve(object sender, ResolveEventArgs e) { if (e.Name == "MYTYPE, MYASSEMBLY, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null") { return Assembly.Load("MYTYPE, MYASSEMBLY, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"); } return null; }

更多推荐

工作流程4持久性,反序列化错误

本文发布于:2023-10-26 07:09:19,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1529431.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:持久性   工作流程   错误   序列化

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!