我在 VB 中有一个 WCF,它将托管在 Windows 服务中。我管理了安装程序,所以服务确实安装了。但是,当我尝试启动该服务时,出现以下错误:
The service on Local Computer started and then stopped. Some services stop automatically if they have no work to do, for example, the Performance Logs and Alerts service.
检查事件查看器给我以下信息:
Service cannot be started. System.ArgumentException: ServiceHost only supports class service types.
at System.ServiceModel.Description.ServiceDescription.GetService(Type serviceType)
at System.ServiceModel.ServiceHost.CreateDescription(IDictionary`2& implementedContracts).........
有人知道发生了什么事吗?谢谢!
最佳答案
ServiceHost 构造函数必须是服务契约的具体实现。
听起来您传递的是接口(interface)而不是服务实现。
关于windows - WCF 托管在 Windows 服务错误中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5957793/