0
我有一個服務,當我添加我的服務引用時,我應該只在客戶端獲得一個端點爲什麼是這樣?在WCF中獲得2個端點而不是預期的端點?
我做了什麼來配置我的服務如下。
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;
}
我有點困惑嗎?
你能後生成的客戶端配置?我很想看看其他端點產生了什麼。爲了解決這個問題,我會檢查WSDL(檢查服務是否確實暴露了2個端點),然後以詳細級別捕獲WCF跟蹤,並檢查Construct主機活動以瞭解從其他端點獲取的位置。 HTH,Amit – amit 2011-05-31 14:08:18