我正在尝试组合一个托管 WCF 服务的 Windows 服务。我的项目结构如下:
- 服务
- 服务合同
- 服务主机
- 服务设置
Service.Host 项目包含 ProjectInstaller,Service.Setup 项目包含 WindowsInstaller。
现在,一切构建和安装都很好,但是当我尝试启动服务时,它会立即停止运行,并在我的事件日志中显示以下消息:
Service cannot be started. System.TypeLoadException: Could not load type 'Service' from
assembly 'Service, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
at Host.Service.OnStart(String[] args)
at System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(Object state)
当我检查我的安装项目的输出文件夹时,我可以同时看到 Service.dll 和 Service.Contracts.dll ......这让我措手不及。当一切正常时,我该如何调试?该怎么办?