Xml WCF web服务和ASMX生成的模式不同
我有以下课程Xml WCF web服务和ASMX生成的模式不同,xml,wcf,web-services,xsd,schema,Xml,Wcf,Web Services,Xsd,Schema,我有以下课程 [Serializable()] [XmlType(AnonymousType=true)][XmlRoot(Namespace="", IsNullable=false)] public class Test { [XmlAttribute()] public string Prop { get; set; } public string Another { get; set; } } 我在WCF web服务(SVC)和ASMX w
[Serializable()]
[XmlType(AnonymousType=true)][XmlRoot(Namespace="", IsNullable=false)]
public class Test
{
[XmlAttribute()]
public string Prop { get; set; }
public string Another { get; set; }
}
我在WCF web服务(SVC)和ASMX web服务中都使用了这个类,我希望得到一个SOAP主体,它对于ASMX和SVC都是一致的,其中“Prop”属性是一个属性。此外,我还尝试向SVC和ASMX添加服务和web引用,以下是XSD的外观:
我的问题是,为什么生成的XSD和SOAPXMLS没有组成?我知道这并不重要,因为无论生成的模式如何,这两种方法都可以工作。WCF默认使用DataContract序列化程序,这与ASMX使用的XmlSerializer不同。因此,生成的XSD也会有所不同-DataCOntract序列化程序不支持XML属性(出于速度原因) 查看Dan Rigsby的精彩文章和Aaron Skonnard的MSDN杂志文章,了解更多详细信息