当在 windows mobile 6.5 设备上运行在 CF 3.5 中的客户端代码尝试调用我们的 wcf 服务时,会发生以下错误......甚至在它发出调用之前。
奇怪的是,在 VS 中的调试器下运行并且手机通过 USB 电缆连接到 PC 时不会发生异常......调用按预期工作......数据按预期来回移动。 ..
但是当单独运行时,CFClientBase 代码会生成以下 Stackoverflow 异常?
所有服务调用都会发生这种情况,而不仅仅是一个......有什么想法吗?
StackOverflowException
at System.Reflection.CustomAttribute.GetObject()
at System.Reflection.CustomAttribute.CheckConsistencyAndCreateArray(CustomAttribute caItem, Type caType)
at System.Reflection.CustomAttribute.GetCustomAttributes(MemberInfo member, Type caType, Boolean inherit)
at System.Reflection.CustomAttribute.GetCustomAttributes(Type type, Type caType, Boolean inherit)
at System.RuntimeType.GetCustomAttributes(Boolean inherit)
at System.Xml.Serialization.TypeAttributes..ctor(ICustomAttributeProvider prov)
at System.Xml.Serialization.TypeAttributes..ctor(ICustomAttributeProvider prov, XmlAttributes xmlAtts)
at System.Xml.Serialization.XmlSerializationReflector.AddType(Type type, Boolean encoded, String defaultNS, Boolean genericNullableArg)
at System.Xml.Serialization.XmlSerializationReflector.FindType(Type type, Boolean encoded, Boolean genericNullableArg, String defaultNamespace)
at System.Xml.Serialization.XmlSerializationReflector.FindType(Type type, Boolean encoded, String defaultNamespace)
at System.Xml.Serialization.XmlSerializationReflector.ResolveLiteralTypeUsingDeclaredType(Type memberType, String defaultNS, LogicalType& type, LogicalType& elementType, Boolean& isArray)
at System.Xml.Serialization.XmlSerializationReflector.ResolveLiteralType(String attrDataType, Type attrType, Type memberType, String defaultNS, Boolean& isArray, LogicalType& type, LogicalType& elementType)
at System.Xml.Serialization.XmlSerializationReflector.ReflectXmlElementAttributes(Type memberType, LogicalMemberValue memberValue, String memberName, LiteralAttributes attrProv, AccessorCollection memberAccessors, String defaultName, String defaultNS, Type& serializingType, Boolean& shouldBeOrdered)
at System.Xml.Serialization.XmlSerializationReflector.ReflectLiteralMemberValue(Type memberType, String memberName, LiteralAttributes attrProv, String defaultName, String defaultNS, IEntityFinder memberFinder, Boolean canRead, Boolean canWrite, Boolean& shouldBeOrdered)
at System.Xml.Serialization.XmlSerializationReflector.ReflectMemberValue(Type memberType, ICustomAttributeProvider attrProv, String defaultName, String defaultNS, IEntityFinder memberFinder, Fetcher fetcher, Fixup fixup, MemberValueCollection members, Boolean encoded, Boolean canRead, Boolean canWrite, Byte& specialType, Boolean& shouldBeOrdered)
at System.Xml.Serialization.XmlSerializationReflector.addComplexTypeMemberHelper(Type type, MemberInfo member, Boolean encoded, String defaultNS, Boolean& shouldBeOrdered, IEntityFinder choiceFinder, MemberValueCollection members, String typeNS, String defaultMemberNS, Int32& sequenceId)
at System.Xml.Serialization.XmlSerializationReflector.AddComplexType(Type type, TypeAttributes attrs, String typeName, String typeNS, Boolean typeIsNullable, Boolean encoded, String defaultNS, Boolean genericNullableArg)
at System.Xml.Serialization.XmlSerializationReflector.AddType(Type type, Boolean encoded, String defaultNS, Boolean genericNullableArg)
at System.Xml.Serialization.XmlSerializationReflector.FindType(Type type, Boolean encoded, Boolean genericNullableArg, String defaultNamespace)
at System.Xml.Serialization.XmlSerializationReflector.FindType(Type type, Boolean encoded, String defaultNamespace)
at System.Xml.Serialization.XmlSerializationReflector.ReflectIncludedTypes()
at System.Xml.Serialization.XmlSerializer..ctor(Type type, XmlAttributeOverrides overrides, Type[] extraTypes, XmlRootAttribute root, String defaultNamespace)
at Microsoft.Tools.ServiceModel.CFClientBase`1.CFContractSerializer.createSerializer(XmlQualifiedName wrapper)
at Microsoft.Tools.ServiceModel.CFClientBase`1.CFContractSerializer..ctor(CFContractSerializerInfo info)
at Microsoft.Tools.ServiceModel.CFClientBase`1.GetContractSerializer(CFContractSerializerInfo info)
at Microsoft.Tools.ServiceModel.CFClientBase`1.Invoke[TREQUEST,TRESPONSE](CFInvokeInfo info, LogIntoServerRequest request)
at WCFService.WOService.WOServiceClient.LogIntoServer(LogIntoServerRequest request)
at WCFService.WOService.WOServiceClient.LogIntoServer(SmartPhoneLoginCredentials creds)
at RescoMobileApp.Common.Classes.loginClass.LogIntoServer()
编辑
看来,即使我使用 DTO 来通过网络进行序列化......不知何故,我的 EF 实体类正在架构中发送?
并且由于某种原因,在进行服务调用时试图构建这些类型?
如何将类排除在架构之外?如果有对实体命名空间的引用,WCF 是否足以将这些类拉入架构?