Hi there,
I have a webapp, VS2013, C# and ASP.NET, and I use Oracle 12c as DB, so when I try to connect to DB from my webapp I got this error: ORA-12541: TNS:no listener, this is my code:
public bool OpenConnection(Label lbl)
{
try
{
using (cn = new OracleConnection(WebConfigurationManager.ConnectionStrings["RegistroConnection"].ToString()))
{
if (cn.State == ConnectionState.Closed)
{
cn.Open();
}
}
return true;
}
catch (NullReferenceException nullExcept)
{
lbl.Text = "Caught error: ." + nullExcept.ToString();
return false;
}
catch (OracleException dbEx)
{
lbl.Text = "OraException - " + dbEx.Message;
return false;
}
catch (Exception ex)
{
Exception current;
current = ex;
while (current != null)
{
current = current.InnerException;
}
lbl.Text = "Db base exception - " + ex.GetBaseException().ToString();
return false;
}
}
I have the connectionstring on my webconfig:
<connectionStrings>
<add name="RegistroConnection"
connectionString="Data Source=(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST =myServer)(PORT = 1521))(CONNECT_DATA =(SERVER = DEDICATED)(SID = sidname)));User Id=user;Password=password;"
providerName="Oracle.DataAccess.Client"/>
</connectionStrings>
the dll already added is:
- Oracle.DataAccess.Client
If i try to connect through Sql Developer I have a successful connection but on my webapp I have this error: ORA-12541: TNS:no listener
Please, somebody help me
I'll waiting for your response!
Thanks and Regards.