I have a ASP .NET Core (v2.0) app with Docker support. And I want to start a Oracle Database when starting my app. This is how my docker-compose file looks like:
version: '3'
services:
devarttestapp:
image: devarttestapp
build:
context: ./DevartTestApp
dockerfile: Dockerfile
oracledb:
image: sath89/oracle-12c
ports:
- "1521:1521"
I use Devart data provider dotConnect for Oracle.
var conn = new Devart.Data.Oracle.OracleConnection();
conn.ConnectionString = Environment.GetEnvironmentVariable("ORACLE_CONNECTION_STRING");
try
{
conn.Open();
}
catch (Exception e)
{
Console.WriteLine(e);
throw;
}
But when I try to connect to the database of the created Oracle DB container I get following exception:
System.Net.Internals.SocketExceptionFactory+ExtendedSocketException (Connection refused 127.0.0.1:1521)
I also tried to include the depends_on as well as the networks option in my docker-compose file with the same results.
What could be the cause of this exception?
And how do I solve this problem?