混合模式程序集是针对运行时的版本"v1.1.4322"构建的,不能 [英] Mixed mode assembly is built against version 'v1.1.4322' of the runtime and cannot

查看:367
本文介绍了混合模式程序集是针对运行时的版本"v1.1.4322"构建的,不能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使Windows服务正常工作,但我不断收到以下错误... 混合模式程序集是针对运行时的版本"v1.1.4322"构建的,如果没有其他配置信息,则无法在4.0运行时中加载.

I am trying to get a windows service to work but I keep getting the following error... Mixed mode assembly is built against version 'v1.1.4322' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.

Windows服务非常简单.它查看一些数据,进行一些组织并将某些信息发送到数据库.如果数据满足某些条件,则该服务将连接到K2 Workflow,找到正确的项目,然后声明并完成该项目.

The windows service is pretty simple. It looks at some data, does some organization and sends some information of to a database. If the data meets certain conditions, the service connects to K2 Workflow, find the correct item, then claims and completes the item.

我的问题是在尝试使用.NET 1.1构建的程序集中连接到K2时发生的.我尝试添加

My problem comes about when trying to connect to K2 in an assembly which was build with .NET 1.1. I have tried adding

<configuration>
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>
</configuration>

到我项目中的所有配置文件,但不起作用.奇特的是,当我在调试模式下运行服务并逐步执行时,我没有任何问题,并且一切正常,但是当我将其安装并作为服务运行时,就会出现此问题.

to any and all config files in my project but it does not work. The peculiar thing is that when I run the service in debug mode and step through, I have no problems and everything works fine, but when I install and run it as a service, this issue comes up.

我已经检查过,以确保安装时会复制该配置,但是现在我很困惑,因为我在任何地方都可以找到的唯一东西就是配置的增加,但这似乎并不能解决我的问题.

I have checked to make sure that the config is getting copied when I install it, but I am just stumped now because the only thing I can find anywhere is the configuration addition which doesnt seem to be solving my problem.

推荐答案

我发现了我的问题.事实证明,这与我使用的框架有关.我以为我的服务exe是myservice.exe,所以我将配置文件命名为myservice.exe.config.经过进一步调查,我发现该服务是从基本服务类继承的,并且可执行文件名为serviceshell.exe,因此我的配置文件需要命名为serviceshell.exe.config.

I figured out my problem. It turns out it had to do with the framework that I was using. I thought that my service exe was myservice.exe so I named my config file myservice.exe.config. Upon further investigation, I found out that the service was inheriting from a base service class and that the executable was named serviceshell.exe so my config file needed to be named serviceshell.exe.config.

这篇关于混合模式程序集是针对运行时的版本"v1.1.4322"构建的,不能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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