各位大佬,小白请教个问题。。
WCF,生成的wsdl文件,我想自定义下图两个红框中的名字,有办法吗?因为不方便写配置,因此我使用的代码的方式,代码如下:
[ServiceContract(Namespace = "http://ws.substation.com/", Name = "SubstationPlatform"
, ConfigurationName = "SubstationServiceLib.SubstationPlatform")]
public interface IDispatchService
{
...
}
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single
, Namespace = "ws.substation.com", Name = "SubstationPlatformImplService"
, ConfigurationName = "SubstationServiceLib.SubstationPlatformService")]
public class DispatchService : IDispatchService
{
...
}
DispatchService service = new DispatchService(this);
this._host = new ServiceHost(service, new Uri(this.clientLocalAddr));
this._host.AddServiceEndpoint(typeof(IDispatchService), new BasicHttpBinding(), new Uri(this.clientLocalAddr));
ServiceMetadataBehavior metadataBehavior = this._host.Description.Behaviors.Find<ServiceMetadataBehavior>();
if (metadataBehavior == null)
{
metadataBehavior = new ServiceMetadataBehavior();
this._host.Description.Behaviors.Add(metadataBehavior);
}
metadataBehavior.HttpGetEnabled = true;
Binding binding = MetadataExchangeBindings.CreateMexHttpBinding();
this._host.AddServiceEndpoint(typeof(IMetadataExchange), binding, "mex");
主要是想把自动生成的后缀_SubstationPlatform给去掉,请问有没有方法可以实现呢?谢谢各位大佬了~