当前位置: 代码迷 >> C# >> wcf序列化有关问题
  详细解决方案

wcf序列化有关问题

热度:88   发布时间:2016-05-05 04:25:40.0
wcf序列化问题,

There was an error while trying to serialize parameter http://www.shiyan56.com:GetProcessLineByIdResult. The InnerException message was 'Type 

'System.Data.Entity.DynamicProxies.ProcessLine_376596B54C4C52E7D20DEAE03D96C5BA56D55C89F7D84766AB4831384EBC11E8' with data contract name 

'ProcessLine_376596B54C4C52E7D20DEAE03D96C5BA56D55C89F7D84766AB4831384EBC11E8:http://schemas.datacontract.org/2004/07/System.Data.Entity.DynamicProxies' is not expected. 
Consider using a DataContractResolver or add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list 

of known types passed to DataContractSerializer.'.  Please see InnerException for more details.
初始wcf,好像是序列化问题,可是不会解决,请大神指点,谢主龙恩!
------解决思路----------------------
你的方法中自定义类型吗?
自定义类型用contract 关键字了吗
------解决思路----------------------
System.Data.Entity.DynamicProxies ??
有用动态类型???
------解决思路----------------------
EF的ORM对象?微软有提供工具的,打开edmx,右键选添加代码生成项,选联机,输入WCF作为关键字。有个EF X.x xxxx with WCF xxx的,应该就是你需要的东西了。
------解决思路----------------------
是不是你要序列化的类中有一个基类的实例? 这样的话, 就得用KnownTypeAttribute指定到底应该使用具体的子类类型.
  相关解决方案