When I've published the ASP.NET Core Web App to Azure I get the following Error when trying to use the oracle database.
NetworkException: ORA-12154: TNS:could not resolve the connect identifier specified
OracleInternal.Network.AddressResolution..ctor(string TNSAlias, SqlNetOraConfig SNOConfig, Hashtable ObTnsHT, Hashtable ObLdpHT, string instanceName, ConnectionOption CO)
OracleException: ORA-12154: TNS:could not resolve the connect identifier specified
OracleInternal.ConnectionPool.PoolManager<PM, CP, PR>.Get(ConnectionString csWithDiffOrNewPwd, bool bGetForApp, OracleConnection connRefForCriteria, string affinityInstanceName, bool bForceMatch)
I fix these errors by setting
TNS_ADMIN & WALLET_LOCATION in my Application settings (ENV)
I have also set WEBSITE_LOAD_USER_PROFILE
Then I get a new error when trying to run Oracle DB code.
An unhandled exception occurred while processing the request.
OracleException: Connection request timed out
OracleInternal.ConnectionPool.PoolManager<PM, CP, PR>.Get(ConnectionString csWithDiffOrNewPwd, bool bGetForApp, OracleConnection connRefForCriteria, string affinityInstanceName, bool bForceMatch)
This one I can't seem to figure out.
Does anyone have any pointers or things I can try ?
My connection string looks like this and works perfectly on the local setup.
"User Id=user;Password=password;Data Source=db202011081718_medium;"
and is injected here in startup.cs
services.AddDbContext<ApplicationDbContext>(options =>
options.UseOracle(
Configuration.GetConnectionString("OracleDBContextConnection")));
I must be missing something, related to the azure/oracle specifics that aren't playing nice
I've watched this video 3/4 times
https://www.youtube.com/watch?v=-IkDuJy30mY
From "db202011081718_medium" I assume you're using an autonomous database.
Can you confirm that you
- downloaded a connection file (zip)
- unzipped into a empty directory (let's assume x:\oracle)
- edited the sqlnet.ora to point to x:\oracle
- set TNS_ADMIN to x:\oracle
At that point, with the Oracle client installed you should be able to do "tnsping db202011081718_medium", eg
C:\>cd C:\oracle\cloud_cmcdonald1
C:\oracle\cloud_cmcdonald1>dir
Volume in drive C is OS
Volume Serial Number is 0F26-5E10
Directory of C:\oracle\cloud_cmcdonald1
16/06/2020 11:37 AM <DIR> .
16/06/2020 11:37 AM <DIR> ..
16/06/2020 03:37 AM 6,733 cwallet.sso
16/06/2020 03:37 AM 6,688 ewallet.p12
16/06/2020 03:37 AM 3,275 keystore.jks
16/06/2020 03:37 AM 691 ojdbc.properties
16/06/2020 03:37 AM 317 README
16/06/2020 11:38 AM 125 sqlnet.ora
16/06/2020 03:37 AM 1,841 tnsnames.ora
16/06/2020 03:37 AM 3,336 truststore.jks
C:\oracle\cloud_cmcdonald1>grep WALLET sqlnet.ora
WALLET_LOCATION = (SOURCE = (METHOD = file) (METHOD_DATA = (DIRECTORY="C:\oracle\cloud_cmcdonald1")))
C:\oracle\cloud_cmcdonald1>set TNS_ADMIN=C:\oracle\cloud_cmcdonald1
C:\oracle\cloud_cmcdonald1>tnsping cmcdonald1_low
TNS Ping Utility for 64-bit Windows: Version 19.0.0.0.0 - Production on 27-NOV-2020 15:49:28
Copyright (c) 1997, 2020, Oracle. All rights reserved.
Used parameter files:
C:\oracle\cloud_cmcdonald1\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (description= (retry_count=20)(re....[rest of tns string]
OK (1360 msec)
Can you get to that point?