我有一个令人沮丧的错误。我正在从 Winforms 应用程序和 Asp.net 页面连接到 Oracle(或尝试)。
Winforms - 没问题,Asp.Net - 很多问题。
我得到的错误(从 IIS 运行)是:
ORA-12545: Connect failed because target host or object does not exist
对我来说,这条消息可能表明我的连接字符串错误或 Oracle 已关闭,或防火墙问题,但我使用的是同一台机器上的 Winforms 工作的相同连接字符串和代码。
知道其他可能导致此错误的想法吗?
失败的代码:
string conn = "User Id=172.xx.xx.xxx ;Password=xxx;Data Source=(DESCRIPTION= (ADDRESS=(PROTOCOL=TCP)(HOST=xx)(PORT=1521)) (CONNECT_DATA=(SID=xxx)));
OracleConnection oc = new OracleConnection(conn);
编辑:
全栈:
ORA-12545: Connect failed because target host or object does not exist
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Oracle.DataAccess.Client.OracleException: ORA-12545: Connect failed because target host or object does not exist
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[OracleException (0x80004005): ORA-12545: Connect failed because target host or object does not exist]
Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure, Boolean bCheck) +1563
Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, Object src) +59
Oracle.DataAccess.Client.OracleConnection.Open() +4899
UDWWeb.Pages.Availability.Button1_Click(Object sender, EventArgs e) +49
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563