IIS 託管 WCF 服務報錯:「Service 'WcfServiceApp.WCFService' has zero application endpoints」。三大原因:
web.config 未複製或路徑錯);<service> 的 name 屬性與實作類別完整名稱不符;<service> 內未定義任何 <endpoint>。<system.serviceModel>
<services>
<service name="WcfServiceApp.WCFService">
<endpoint address="" binding="wsHttpBinding" contract="WcfServiceApp.IWCFService">
<identity> <dns value="localhost" /> </identity>
</endpoint>
</service>
</services>
</system.serviceModel>
或程式碼自託管:
using (var host = new ServiceHost(typeof(WCFService.WCFService)))
{
host.AddServiceEndpoint(typeof(IWCFService), new NetTcpBinding(), "net.tcp://localhost:8001/WCFService");
host.Open(); Console.Read();
}