我正在使用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時抱怨這個?