简体   繁体   中英

System.DllNotFoundException: Unable to load DLL 'oci' when published to IIS

I have a .net core application and I have to use System.Data.OracleClient.dll to connect with oracle db.

Everything works when I run this in VS2017 but when I publish and try to run the part that connects to the database I get an error:

System.DllNotFoundException: Unable to load DLL 'oci': The specified module could not be found. (Exception from HRESULT: 0x8007007E) at System.Data.OracleClient.Oci.OciCalls.OciNativeCalls.OCIEnvCreate(IntPtr& envhpp, OciEnvironmentMode mode, IntPtr ctxp, IntPtr malocfp, IntPtr ralocfp, IntPtr mfreep, Int32 xtramem_sz, IntPtr usrmempp)

Am I missing some kind of IIS module? I have x64 bit oracle in same PC.

可能是您缺少了OciCalls类调用的本机代码(可能是某些本机dll或类似的dll),或者找不到它在所查找的位置,无论如何,您都可以使用Assembly Binding Log Viewer对其进行调试以查看其位置探测以及缺少的东西。

For me finally helped following steps:

  1. Got x86 Oracle Instant client from ( http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html )
  2. Added instant client folder to environment path to the first position so that it will precede all other oracle paths.
  3. Restarted machine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM