我正在尝试通过 Windows 桌面应用程序启动和停止 WCF 服务库但卡住了。我无法启动它,因为它给了我错误shost.Open();
代码:
private void startwcfedcHost()
{
ServiceHost shost = new ServiceHost(typeof(WcfServiceLibrary.Service));
shost.Open();
}
错误:
Service 'WcfServiceLibrary.Service' has zero application (non-infrastructure) endpoints.
这可能是因为没有为您的应用程序找到配置文件,或者因为在配置文件中找不到与服务名称匹配的服务元素,或者因为在服务元素中没有定义端点。
但是当我尝试运行我的 wcf 服务时,它可以工作,我该如何解决这个问题?