I am having a problem installing a Windows Service application on my computer. If I am successful I expect to see my service listed under Computer ManagementServices and ApplicationServices.

I first try to click on my exe. I get this message:

Cannot start service from the command line or a debugger. A Windows Service must first be installed (using installutil.exe) and then started with the ServiceExplorer, Windows Service Adminstration tool or the Net Start command.

So I tried to using the installutil tool. From a command prompt I typed installutil ooaservice.exe. I get a message

Exception occurred while initializing the installation: System.badimageformatexception: could not load file or assembly ‘file///(the path to my exe follows)ooaservice.exe’ or one of its dependencies. This assembly is built by a runtime newer than the currently loaded one and cannot be loaded…

I also tried to build a setup project. The setup installs successfully but the service is not listed as a service.

有帮助吗?

解决方案

There should be several versions of .NET frameworks installed on your machine, try to use the highest version of installutil to install.

On my machine it is under E:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top