我要在 Windows 上安装 WCF 服务。
现在我想把它安装在一个运行windows的服务器上,并且已经安装了v3.5 .net框架。
服务是用framework 4编写的,所以不会运行。
我的问题是我可以使用框架 3.5 中的“installutil”来安装服务吗?为什么?
===更新===
我有在里面运行 wcf 的 Windows 服务。
最佳答案
您使用 InstallUtil 安装 Windows 服务。如果您遵循类似于以下 MSDN 文章 How to: Host a WCF Service in a Managed Windows Service 的内容,您的 WCF 服务可能已经在 Windows 服务内开发。 .
但是,如果 (Windows) 服务是用 .NET 4 编写的,并且您尝试从 .net 3.5 运行 installutil,您将收到以下错误:
Exception occurred while initializing the installation: System.BadImageFormatException: Could not load file or assembly 'file:///C:\MyService.exe' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded..
要安装 .NET 4 (Windows) 服务,您需要使用 .NET 4 installutil,它位于:C:\Windows\Microsoft.NET\Framework64\v4.0.30319\installutil.exe 之后.NET 4 安装。
关于c# - 使用 Installutil 安装服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10294763/