我寫了一個工作正常的wcf服務。 在客戶端我使用VS2008的AddServiceReference功能來生成客戶端代理,它也工作正常。 現在,爲了學習的目的,我想用svcutil.exe工具生成我的客戶端代理,但我無法使用它,我已嘗試但不知道什麼是缺少的,也許我缺少一些參數,我知道AddServiceReference功能也使用svcutil.exe在客戶端生成代理。如何使用svcutil.exe創建客戶端代理ib WCF?
任何人都請告訴我如何使用。
其實我的wcf服務項目位於C:\ Projects \ WCFService,我的客戶端位於 C:\ Projects \ WCFClient。
下面是我的服務類...
Uri address = new Uri("http://localhost:8090/MathServices/");
using (ServiceHost host = new ServiceHost(typeof(MathOperations), address))
{
BasicHttpBinding binding = new BasicHttpBinding();
host.AddServiceEndpoint(typeof(IMathOperations), binding, "");
ServiceMetadataBehavior metaDataBehavior = new ServiceMetadataBehavior();
metaDataBehavior.HttpGetEnabled = true;
host.Description.Behaviors.Add(metaDataBehavior);
host.Open();
}
+1我也建議看這個視頻:http://www.dnrtv.com/default.aspx?showNum=122 – 2009-09-22 01:05:23