2011年3月21日 星期一

OralceClient預設版本問題

原本公司的專案都是採用.net framework 2.0
可是這次接手的是採用.net framework 4.0
原本在本機RUN時都沒有問題, 可是放到IIS上卻出現以下錯誤

System.Data.OracleClient requires Oracle client software version 8.1.7 or greater.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Exception: System.Data.OracleClient requires Oracle client software version 8.1.7 or greater.

一開始以為是web.config設定的版本有問題, 結果一看設定如下:
<add assembly="System.Data.OracleClient, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
因為是找不到特定版本, 所以就去追Assembly, 發現系統裡並沒有.4.X版

接著試著改成
<add assembly="System.Data.OracleClient, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
結果得到同樣的錯誤, 感覺程式還是去抓4.X的版本


追了好久, 中間一度把framework版本降回2.0 後來才發現
原來專案中某支程式定義了預設值如下:
因為這裡定義了預設值, 而且我在web.config裡又沒有設定預設值,
結果就是程式裡定義的為準.

修改方法就是在web.config裡加上這段


在web.config指定特定版本的OracleClient版本即可解決問題

沒有留言:

張貼留言