windows - WCF 托管在 Windows 服务错误中

标签 windows wcf service host

我在 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/

相关文章:

windows - 为什么 Visual Studio 2017 在启动时打开 Windows "For developers"设置?

windows - 我可以一直假设 sizeof(GUID)==16 吗?

c# - WCF 流文件问题

android - 服务上的 OnBind() 总是返回 False - Android

windows - 如何在 Windows 上的 powershell 上执行 sudo

c# - 使用多个代理客户端时如何修复 WCF 中的 basicHttpBinding?

ajax - 为什么使用 wsHttpBinding 时 InstanceContextMode.PerSession 的行为类似于 PerCall?

elasticsearch - 如何在centos 7中启动elasticsearch作为服务运行?

android - 单击按钮时启动服务时出现问题

windows - Windows 是否像 Linux 一样具有 Inode 编号?