Getting 2 endpoint other than expected one in WCF?
I have a service where I am supposed to get only one end point at client when adding my service reference why is that so?
what i have done to configure my service is given below.
try
{
Uri baseAddress = new Uri("http://localhost:8080/Easicreate/SearchService");开发者_StackOverflow社区
BasicHttpBinding binding = new BasicHttpBinding();
this.host = new ServiceHost(typeof(SearchServiceContract));
this.host.AddServiceEndpoint(typeof(ISearchServiceContract), binding, "http://localhost:8080/Easicreate/SearchService");
//// Enable metadata publishing.
ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
smb.HttpGetEnabled = true;
smb.HttpGetUrl = baseAddress;
smb.MetadataExporter.PolicyVersion = PolicyVersion.Policy15;
this.host.Description.Behaviors.Add(smb);
this.host.Open();
}
catch (Exception ex)
{
this.host = null;
}
I am little bit confused ?
i am not sure but try removing
smb.HttpGetUrl = baseAddress;
and check as you are passing same baseAddress in endpoint and in behaviour, either dont pass url in endpoint
精彩评论