0

I have a web site project that in Visual Studio 2017 with Oracle 64 bits that when I open it and run it all is ok. If I stop and run again or I build the solution I get the error below. I have other projects on the same machine that also use Oracle and they work ok, any suggestions on what I can do to find the reason why?

Could not load file or assembly 'Oracle.DataAccess, Version=4.122.19.1, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified.

web.config

<configuration>
  <system.web>
    <sessionState mode="InProc" cookieless="false" timeout="3"/>
    <compilation debug="true" targetFramework="4.5">
      <assemblies>
        <add assembly="System.DirectoryServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="Oracle.DataAccess, Version=4.122.19.1, Culture=neutral, PublicKeyToken=89B483F429C47342"/>
        <add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
      </assemblies>
    </compilation>
    <httpRuntime targetFramework="4.5"/>
  </system.web>
</configuration>

gacutil

gacutil /l | findstr Oracle.Data
  Oracle.DataAccess, Version=2.122.19.1, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64
  Oracle.DataAccess, Version=4.122.19.1, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64
Eduardo Reis
  • 1
  • 1
  • 2
  • Your GAC has the 64-bit assemblies. Do you run/compile your application also in 64-bit mode? – Wernfried Domscheit Apr 14 '22 at 11:37
  • The GAC should also include some Policies, e.g. ` Policy.4.112.Oracle.DataAccess, Version=4.121.2.0 ...`. They redirect older references to installed version, see https://stackoverflow.com/questions/44818069/how-to-load-specific-version-of-assembly-from-gac – Wernfried Domscheit Apr 14 '22 at 11:44
  • @WernfriedDomscheit It's compiling in 64 bits, I think it is. How can I check that? The missing policy entries don't explain why one project works and the other don't. – Eduardo Reis Apr 14 '22 at 13:13
  • You set it in the compiler dialog, should be quite obvious. Or use [sigcheck](https://learn.microsoft.com/en-us/sysinternals/downloads/sigcheck) on existing .exe. Or you may use my [Connection Tester](https://github.com/Wernfried/connection-tester) – Wernfried Domscheit Apr 14 '22 at 13:55
  • It's a web site, there is no exe. I can't build the solution but the IIS express starts and the code works. I added screenshots above for the properties – Eduardo Reis Apr 14 '22 at 14:15
  • The sigcheck-tool works also with .DLL's. Is the IIS express also 64-bit (you could also check with the sigcheck tool) – Wernfried Domscheit Apr 14 '22 at 15:49

0 Answers0