c# - 使用 Installutil 安装服务

标签 c# .net wcf installutil

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

相关文章:

c# - 是否可以使用属性更改 WCF 服务的 ServiceHostFactory?

wcf - 如何在 WCF 中启用 webHttp 连接?

c# - 遍历嵌入式资源并复制到本地路径

c# - 如何禁止在 .NET 中将按键打印到控制台?

c# - 如何让 WCF 服务运行在 SSL 上?

c# - 如何比较 .NET 中的执行路径?

c# - 将 Kinect ColorImageFrame 转换为位图

c# - 是否可以以编程方式创建哈希规则?

c# - Active Directory 联合身份验证服务是否支持 OpenID Connect 声明提供程序

c# - native C# pdf 阅读器