- 3,715,598 Users
- 2,242,806 Discussions
- 7,845,454 Comments
Forum Stats
Discussions
Categories
- 16 Data
- 362.2K Big Data Appliance
- 7 Data Science
- 1.6K Databases
- 465 General Database Discussions
- 3.7K Java and JavaScript in the Database
- 22 Multilingual Engine
- 487 MySQL Community Space
- 3 NoSQL Database
- 7.6K Oracle Database Express Edition (XE)
- 2.8K ORDS, SODA & JSON in the Database
- 416 SQLcl
- 42 SQL Developer Data Modeler
- 184.8K SQL & PL/SQL
- 21K SQL Developer
- 1.8K Development
- 3 Developer Projects
- 32 Programming Languages
- 135.1K Development Tools
- 8 DevOps
- 3K QA/Testing
- 247 Java
- 5 Java Learning Subscription
- 10 Database Connectivity
- 66 Java Community Process
- 1 Java 25
- 9 Java APIs
- 141.1K Java Development Tools
- 6 Java EE (Java Enterprise Edition)
- 153K Java Essentials
- 135 Java 8 Questions
- 86.2K Java Programming
- 270 Java Lambda MOOC
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 10 Java SE
- 13.8K Java Security
- 3 Java User Groups
- 22 JavaScript - Nashorn
- 18 Programs
- 125 LiveLabs
- 30 Workshops
- 9 Software
- 3 Berkeley DB Family
- 3.5K JHeadstart
- 5.7K Other Languages
- 2.3K Chinese
- 3 Deutsche Oracle Community
- 10 Español
- 1.9K Japanese
- 2 Portuguese
EF Core 3.1 - Exception when trying to use TnsAdmin
I'm getting the following error when trying to set a TnsAdmin path: OracleConfiguration.TnsAdmin = @c:\oracle\client\19c\network\admin;
System.IO.FileNotFoundException
HResult=0x80070002
Message=Could not load file or assembly 'System.DirectoryServices.Protocols, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Source=Oracle.ManagedDataAccess
StackTrace:
at OracleInternal.Network.LDAP..ctor(SqlNetOraConfig SNOConfig, Hashtable ObLdapHT)
at OracleInternal.Network.AddressResolution.SetNewLDAP(Hashtable SQLNetHT, Hashtable LdapHT)
at Oracle.ManagedDataAccess.Client.OracleConfiguration.set_TnsAdmin(String value)
at GNB.ELG.WellVoucher.Website.External.Startup.ConfigureServices(IServiceCollection services) in C:\workarea\Startup.cs:line 32
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.InvokeCore(Object instance, IServiceCollection services)
at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass9_0.<Invoke>g__Startup|0(IServiceCollection serviceCollection)
at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.Invoke(Object instance, IServiceCollection services)
at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass8_0.<Build>b__0(IServiceCollection services)
at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.UseStartup(Type startupType, HostBuilderContext context, IServiceCollection services)
at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass12_0.<UseStartup>b__0(HostBuilderContext context, IServiceCollection services)
at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider()
at Microsoft.Extensions.Hosting.HostBuilder.Build()
at GNB.ELG.WellVoucher.Website.External.Program.Main(String[] args) in C:\workarea\Program.cs:line 16
This is a brand new ASP.net Core 3.1 project that isn't really doing much of anything yet. Scaffolding the dbcontext from the database works fine, however trying to run the project results in this error.
I've got the same thing in an ASP.net Core 2 project and that works without issue pointing to the same path, so I'm not sure what changed. I don't have an ldap.ora defined at all, and sqlnet.ora is as follows:
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES)
SQLNET.CRYPTO_SEED = "X"
NAMES.DEFAULT_DOMAIN = X
NAME.DEFAULT_ZONE = X
Thanks
Message was edited by: Tridus (removed beta tag as it is still an issue in production)
Best Answer
-
Oracle uploaded a fix for this bug last night on NuGet Gallery. You can download it here: https://www.nuget.org/packages/Oracle.ManagedDataAccess.Core/
Answers
-
As an update, this seems to happen if sqlnet.ora is found at all. I can remove everything from sqlnet.ora it and it still happens. If I rename sqlnet.ora to something else, the problem goes away, it picks up tnsnames.ora, and things work just fine.
-
Just posting to add that it's still an issue with the 3.1 release version.
-
My dev team found the bug. It looks like a regression. We filed a bug (31867606) on your behalf and will work on a fix.
-
Great, thank you!
-
We are experiencing the same issue.
As a workaround I have renamed the sqlnet.ora. I am not sure if this causes any side effects.
We have already filed an issue on github: https://github.com/oracle/dotnet-db-samples/issues/99
-
This bug has been fixed and will be part of our next ODP.NET 19.10 release.
-
While you're waiting for a fix, there are a couple workarounds. You can either:
- Include the System.DirectoryServices.Protocols NuGet package or
- Don't set TnsAdmin via OracleConfiguration. Use other means to get the configuration info.
-
Including the package System.DirectoryServices.Protocols solved the problem for us.
Many thanks for the quick response.
-
It seems like the the core version is prone to this, too.
Are you aware of that ?
-
Ok this was non-sense... I´m sorry...
The question to ask would be: What exactly do I need to get the fix ? Using Oracle.Enitity.Framework.Core 3.19.80 still results in that issue - I still need to include the protocols package...
-
Oracle uploaded a fix for this bug last night on NuGet Gallery. You can download it here: https://www.nuget.org/packages/Oracle.ManagedDataAccess.Core/
-
Works great, thanks Alex!
-
If you're only pulling in Oracle.EntityFramework.Core, it's probably grabbing the minimum version of Oracle.ManagedDataAccess.Core that it requires, which is where the bug is present.
Go into NuGet and get Oracle.ManagedDataAccess.Core 2.19.91 specifically. That resolves the issue.