我有一项服务,在添加服务时,我应该只在客户端获得一个终点为什么会这样?
我在下面给出了配置我的服务所做的工作。 try
{
Uri baseAddress = new Uri("http://localhost:8080/Easicreate/SearchService");
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;
}
我有点困惑?
答案 0 :(得分:0)
我不确定但是请尝试删除
smb.HttpGetUrl = baseAddress;
并检查当您在端点和行为中传递相同的baseAddress时,要么在端点中传递url