当我尝试托管 WCF 服务时,我遇到了以下异常:
Service 'WcfServiceLibrary3.Service1' has zero application (non-infrastructure) endpoints. This might be because no configuration file was found for your application, or because no service element matching the service name could be found in the configuration file, or because no endpoints were defined in the service element.
我正在使用以下代码:
using (System.ServiceModel.ServiceHost host = new System.ServiceModel.ServiceHost(typeof(WcfServiceLibrary1.Service1)))//Line 1
{
host.Open();
Console.WriteLine("Service started. press any key to stop it");
Console.ReadLine();
host.Close();
}
此错误出现在第 1 行。任何人都可以帮助解决此异常。