我正在使用svcutil.exe根据来自外部来源的合同生成服务端点。WCF合同优先:complexType已被声明
似乎按预期方式工作,但服务不能端点暴露给他人。
具体而言,当我试着去理解服务的WSDL,抛出一个异常,出现以下错误:
System.InvalidOperationException: An exception was thrown in a call to a WSDL export extension: System.ServiceModel.Description.XmlSerializerOperationBehavior contract: http://tempuri.org/xml/wsdl/soap11/DistributionService/1/port:DistributionReceiverWebServicePort ----> System.Xml.Schema.XmlSchemaException: The complexType ' http://tempuri.org/xml/wsdl/soap11/DistributionService/1/types:FejlType ' has already been declared.
但是 - 在FejlType
型类型仅定义一次,但却是一个非常简单的类:
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://tempuri.org/xml/wsdl/soap11/DistributionService/1/types")]
[System.Runtime.Serialization.DataContractAttribute(Name = "FejlType", Namespace = "http://tempuri.org/xml/wsdl/soap11/DistributionService/1/types")]
public class FejlType : object, System.Runtime.Serialization.IExtensibleDataObject
{
private System.Runtime.Serialization.ExtensionDataObject extensionDataField;
private string FejlKodeField;
private string FejlTekstField;
public System.Runtime.Serialization.ExtensionDataObject ExtensionData
{
get {return this.extensionDataField;}
set {this.extensionDataField = value;}
}
[System.Runtime.Serialization.DataMemberAttribute(IsRequired = true, EmitDefaultValue = false)]
public string FejlKode
{
get {return this.FejlKodeField;}
set {this.FejlKodeField = value;}
}
[System.Runtime.Serialization.DataMemberAttribute(IsRequired = true, EmitDefaultValue = false)]
public string FejlTekst
{
get {return this.FejlTekstField;}
set {this.FejlTekstField = value;}
}
}
我完全在这里黑暗 - 为什么WCF在输出WSDL时抱怨这个?