Oracle错误:ORA-12541:TNS:打开连接时没有监听器 [英] Oracle Error: ORA-12541: TNS:no listener when I open connection

查看:399
本文介绍了Oracle错误:ORA-12541:TNS:打开连接时没有监听器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,



我有一个webapp,VS2013,C#和ASP.NET,我使用Oracle 12c作为DB,所以当我尝试连接到来自我的webapp的数据库我收到了这个错误:ORA-12541:TNS:没有听众,这是我的代码:



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;
           }
       }





我的webconfig上有连接字符串:





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>





已添加的dll为:

- Oracle.DataAccess.Client



如果我尝试通过Sql Developer连接我有一个成功的连接,但在我的webapp上我有这个错误:ORA-12541:TNS:没有听众



拜托,有人帮帮我



我等着你的回复!



谢谢和问候。



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.

推荐答案

试试这里:

http://www.dba-oracle.com/t_ora_12541_tns_no_listener.htm [ ^ ]


这篇关于Oracle错误:ORA-12541:TNS:打开连接时没有监听器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆