<Client>
<Endpoint address = "http ://..."
Binding = "basichttpbinding" bindingconfiguration = "..."
Contract = "..." name = "endpoint1"/>
</Clent>
Then, when we read endpoint. name in the program, we find that endpoint1 cannot be found, and the bindingname_contractname will be returned.
Code:
public string get_Name(){ if (!XmlName.IsNullOrEmpty(this.name)) { return this.name.EncodedName; } if (this.binding != null) { return string.Format(CultureInfo.InvariantCulture, "{0}_{1}", new object[] { new XmlName(this.Binding.Name).EncodedName, this.Contract.Name }); } return this.Contract.Name;} |
Code:
Private serviceendpointCreateserviceendpoint()
{
TypeloaderLoader= New typeloader ();
ServiceendpointServiceendpoint= New serviceendpoint (loader. loadcontractdescription (this. contracttype ));
If (this. Address! = NULL)
{
Serviceendpoint. Address = new endpointaddress (New uri (this. Address), this. Identity, new addressheader [0]);
}
If (this. Binding! = NULL)
{
Serviceendpoint. Binding = This. binding;
}
If (this. configurationname! = NULL)
{
New configloader (). loadchannelbehaviors (serviceendpoint, this. configurationname );
}
Complustypedchannelbuildertrace. Trace (traceeventtype. verbose, 0x5001e, "tracecodecomintegrationtypedchannelbuilderloaded", this. contracttype, this. Binding );
Return serviceendpoint;
}
There is no such thing as name, which is not a major bug. Therefore, you can simply set it to "bindingname + _ + contractname" to avoid confusion.