部署win服务时出现下面的问题:

在事件查看器中看到如下错误:

 

日志名称: Application
来源: ***调度服务
日期: 2014/5/21 12:53:21
事件 ID: 0
任务类别: 无
级别: 错误
关键字: 经典
用户: 暂缺
计算机: ams-webserver
描述:
Service cannot be started. Achievo.Utility.DataAccess.DbException: Attempt to load Oracle client libraries threw BadImageFormatException. This problem will occur when running in 64 bit mode with the 32 bit Oracle client components installed.

 

ConnectionString:
Data Source=***;User ID=***;Password=***;Enlist=false;Pooling=True;Min Pool Size=1;Max Pool Size=100

CommandText:
...

FieldName DBType FieldValue FieldType

---> System.InvalidOperationException: Attempt to load Oracle client libraries threw BadImageFormatException. This problem will occur when running in 64 bit mode w...
事件 Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="***调度服务" />
<EventID Qualifiers="0">0</EventID>
<Level>2</Level>
<Task>0</Task>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2014-05-21T04:53:21.000000000Z" />
<EventRecordID>1334</EventRecordID>
<Channel>Application</Channel>
<Computer>ams-webserver</Computer>
<Security />
</System>
<EventData>
<Data>Service cannot be started. Achievo.Utility.DataAccess.DbException: Attempt to load Oracle client libraries threw BadImageFormatException. This problem will occur when running in 64 bit mode with the 32 bit Oracle client components installed.

 

ConnectionString:
...

CommandText:
...

FieldName DBType FieldValue FieldType

---&gt; System.InvalidOperationException: Attempt to load Oracle client libraries threw BadImageFormatException. This problem will occur when running in 64 bit mode w...</Data>
</EventData>
</Event>

 

 

解决方案:

这个是因为本身机器上装的是64未的操作系统,而这个机器上装的却是32位的Oracle客户端。所以会报这样的错误。

网上查到的很多都是下载什么Oracle的client多少版本,然后再去用一堆繁杂的配置步骤,或者说是由于权限问题,要用管理员运行这个程序或者给这个win服务运行的程序.exe文件赋予权限或者兼容之类的操作。

其实这些都是不一定能解决问题的,最好的方法就是重新编译这个win服务所运行的.exe项目。然后再把生成X86的.exe文件替换原来的那个exe文件即可。

具体步骤:

1、找到对应的项目,右键-->属性-->生成-->目标平台    设置为“X86”

2、重新生成这个项目

3、将bin文件夹里面的对应的.exe文件覆盖要部署的同名文件

4、安装成功!

posted on 2014-06-13 15:57  腾哥来了  阅读(2668)  评论(0编辑  收藏  举报