为什么我无法安装我的服务(运行时比加载运行时更新)? [英] Why can't I install my service (runtime newer than loaded runtime)?

查看:271
本文介绍了为什么我无法安装我的服务(运行时比加载运行时更新)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我建立在C#中的服务,我想用下面的命令来安装它:

So I built a service in C# and I am trying to use the following command to install it:

C:\ WINDOWS \ Microsoft.NET \ Framework64 \ V2.0.50727 \ installutil.exe MyService.exe >> installLog.txt

C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\installutil.exe MyService.exe >> installLog.txt

它失败。当我看installLog.txt,我得到这样的:

It fails. When I look at the installLog.txt, I get this:

Microsoft (R) .NET Framework Installation utility Version 2.0.50727.3053
Copyright (c) Microsoft Corporation.  All rights reserved.

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.0是书面的,而一个是3.5。

The same approach works fine for installing a different assembly. I feel like it might be because the one that fails was written for .NET 4.0, and the one that works is in 3.5.

有没有人有这个问题的经验吗?

Does anyone have any experience with this problem?

推荐答案

甚至没有人差点让这一个!

Nobody even came close to getting this one!

这是我必须做的:

  1. 右键单击该服务项目在Visual Studio中,进入属性
  2. 设置启动对象的服务的名称(它已被设置为值(未设置))。
  3. 保存。
  4. 在建立
  5. 尝试重新安装。
  6. 在它的工作原理!好极了!我们都可以回家了!

链接,帮助文章:

<一个href="http://www.$c$cproject.com/kb/dotnet/simplewindowsservice.aspx">http://www.$c$cproject.com/kb/dotnet/simplewindowsservice.aspx

这篇关于为什么我无法安装我的服务(运行时比加载运行时更新)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆