大家好,我是架构君,一个会写代码吟诗的架构师。今天说一说System.Data.OracleClient.OracleException:ORA-12154: TNS:could not resolve the connect identifier spe「建议收藏」,希望能够帮助大家进步!!!
代码语言:txt复制 最近接手离职同事的项目,交接进行了30分钟,牛人直接给了我一个.7z的压缩包,然后电话不接,QQ消息不回,失踪了。
没法,将压缩包解压出来之后,打算编译一个版本准备先发布到服务器上去
项目环境:
VS2010 MVC3 ORACLE,
服务器环境:
PL/SQL Developer
Version 7.1.1.1339
Windows Vista (64-bit) 6.0 Build 6002 (Service Pack 2)
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
X86下本地测试一切正常,
于是乎编译X64往64位Server 2008服务器上放的时候发生错误-
System.Data.OracleClient.OracleException:ORA-12154: TNS:could not resolve the connect identifier spe
当前服务器上有一个老的版本,并且应用程序池设定不兼容32bit,能够正常运行,PLSQL也运行正常,数据库操作正常,可就是新部署的新版本网站不正常,报错信息如下。
我发现这个Exception来至于System.Data.OracleClient.OracleException ,
1>我下载了一个64位的System.Data.OracleClient.dll测试,问题依旧,
2>我在程序池中设定兼容32位,然后本地BUILD 一个x86的包部署,不但所有DLL无法加载,老的版本也跟着报错
3>改回设定默认:不兼容32位,然后本地BUILDX64,ANYCPU的包部署,问题依旧,
ORA-12154: TNS:could not resolve the connect identifier specified
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: System.Data.OracleClient.OracleException: ORA-12154: TNS:could not resolve the connect identifier specified
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:
代码语言:javascript复制[OracleException (0x80131938): ORA-12154: TNS:could not resolve the connect identifier specified
]
System.Data.OracleClient.OracleException.Check(OciErrorHandle errorHandle, Int32 rc) 519713
System.Data.OracleClient.OracleInternalConnection.OpenOnLocalTransaction(String userName, String password, String serverName, Boolean integratedSecurity, Boolean unicode, Boolean omitOracleConnectionName) 469060
System.Data.OracleClient.OracleInternalConnection..ctor(OracleConnectionString connectionOptions) 147
System.Data.OracleClient.OracleConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject) 58
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) 49
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) 417430
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) 91
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) 1922
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) 85
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) 253966
System.Data.OracleClient.OracleConnection.Open() 48
NHibernate.Connection.DriverConnectionProvider.GetConnection() 377
NHibernate.Tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.Prepare() 92
NHibernate.Tool.hbm2ddl.SchemaMetadataUpdater.GetReservedWords(Dialect dialect, IConnectionHelper connectionHelper) 154
NHibernate.Tool.hbm2ddl.SchemaMetadataUpdater.Update(ISessionFactory sessionFactory) 312
NHibernate.Impl.SessionFactoryImpl..ctor(Configuration cfg, IMapping mapping, Settings settings, EventListeners listeners) 1810
NHibernate.Cfg.Configuration.BuildSessionFactory() 292
iTCP.Db.NHibernateSession..cctor() in D:contiITCPCherySolutionsiTCP.DbNHibernateSession.cs:22
[TypeInitializationException: The type initializer for 'iTCP.Db.NHibernateSession' threw an exception.]
iTCP.Db.NHibernateSession.GetNHibernateSession() in D:contiITCPCherySolutionsiTCP.DbNHibernateSession.cs:32
iTCP.Db.SessionFactory.GetSession() in D:contiITCPCherySolutionsiTCP.DbSessionFactory.cs:33
iTCP.Db.NHibFactory.get_DataBaseSession() in D:contiITCPCherySolutionsiTCP.DbNHibFactory.cs:68
iTCP.Db.DBHelper.GetList(String strWhere, String strSortFiled, Boolean direction, Boolean sessionClear) in D:contiITCPCherySolutionsiTCP.DbDBHelper.cs:248
iTCP.Db.DBHelper.GetList(String strWhere, String strSortFiled, Boolean direction) in D:contiITCPCherySolutionsiTCP.DbDBHelper.cs:234
iTCP.Lib.LogManageLib.GetLastQuitMessage() in D:contiITCPCherySolutionsiTCP.LibLogManageLib.cs:92
iTCP.Web.Controllers.HomeController.Index(Nullable`1 pageindex) in D:contiITCPCherySolutionsiTCP.WebControllersHomeController.cs:34
lambda_method(Closure , ControllerBase , Object[] ) 118
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) 248
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) 39
System.Web.Mvc.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() 125
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) 640
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) 640
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) 312
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) 691
System.Web.Mvc.Controller.ExecuteCore() 162
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) 305
System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() 62
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() 20
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() 453
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) 371
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1