OCIEnvCreate失败错误 - 访问.aspx页面时

时间:2008-11-12 22:18:39

标签: asp.net oracle10g

当我尝试通过localhost访问.aspx页面时,我当前遇到了ASP.NET错误。这是错误:

OCIEnvCreate失败,返回码为-1,但错误消息文本不可用。

说明:执行当前Web请求期间发生了未处理的异常。请查看堆栈跟踪,以获取有关错误及其在代码中的起源位置的更多信息。

异常详细信息:System.Exception:OCIEnvCreate失败,返回码为-1,但错误消息文本不可用。

堆栈追踪:

[Exception: OCIEnvCreate failed with return code -1 but error message text was not available.]
   System.Data.OracleClient.OciHandle..ctor(OciHandle parentHandle, HTYPE handleType, MODE ocimode, HANDLEFLAG handleflags) +363
   System.Data.OracleClient.OciEnvironmentHandle..ctor(MODE environmentMode, Boolean unicode) +23
   System.Data.OracleClient.OracleInternalConnection.OpenOnLocalTransaction(String userName, String password, String serverName, Boolean integratedSecurity, Boolean unicode, Boolean omitOracleConnectionName) +122
   System.Data.OracleClient.OracleInternalConnection..ctor(OracleConnectionString connectionOptions) +135
   System.Data.OracleClient.OracleConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject) +36
   System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +28
   System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +424
   System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +68
   System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +519
   System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +82
   System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +104
   System.Data.OracleClient.OracleConnection.Open() +37
   Wilson.ORMapper.Internals.Connection..ctor(String connectString, CustomProvider customProvider) +287

[ORMapperException: ObjectSpace: Connection String is Invalid - OCIEnvCreate failed with return code -1 but error message text was not available.]
   Wilson.ORMapper.Internals.Connection..ctor(String connectString, CustomProvider customProvider) +357
   Wilson.ORMapper.Internals.Context.Init(XmlDocument xmlMappings, String connectString, CustomProvider customProvider, Int32 sessionMinutes, Int32 cleanupMinutes) +92
   Wilson.ORMapper.Internals.Context..ctor(Stream mappingStream, String connectString, CustomProvider customProvider, Int32 sessionMinutes, Int32 cleanupMinutes) +171
   Wilson.ORMapper.ObjectSpace..ctor(Stream mappingStream, String connectString, Provider providerType, Int32 sessionMinutes, Int32 cleanupMinutes) +66
   zedi.DataManager.GetDefaultInstance() in C:\projects\FINE Application Interface\Production\On-site Backlog\Source\Code\DataAccess\ORClasses\Data\DataManager.cs:155
   zedi.DataManager.get_ObjectSpaceGlobal() in C:\projects\FINE Application Interface\Production\On-site Backlog\Source\Code\DataAccess\ORClasses\Data\DataManager.cs:105
   zedi.DataManager.get_ObjectSpace() in C:\projects\FINE Application Interface\Production\On-site Backlog\Source\Code\DataAccess\ORClasses\Data\DataManager.cs:129
   zedi.DataObjects.CompanyBase.RetrieveQuery(ObjectQuery query) in C:\projects\FINE Application Interface\Production\On-site Backlog\Source\Code\DataAccess\ORClasses\DataObjects\Base\CompanyBase.cs:279
   zedi.DataObjects.CompanyBase.RetrieveAll(String sortClause) in C:\projects\FINE Application Interface\Production\On-site Backlog\Source\Code\DataAccess\ORClasses\DataObjects\Base\CompanyBase.cs:78
   maint_inetpub.siteTemplates.updateDeviceTemplate.Page_Load(Object sender, EventArgs e) in c:\projects\FINE Application Interface\Production\On-site Backlog\Source\Code\Websites\maint-inetpub\siteTemplates\updateDeviceTemplate.aspx.cs:47
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +33
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +47
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436

我注意到它说我有一个无效的连接字符串,但我测试了它,它的工作原理。我目前安装了Oracle 10g Express,之前我使用的是Oracle 8i Client。在我安装10g Express之前它正在工作。

5 个答案:

答案 0 :(得分:2)

我遇到了与oracle 10g相同的问题,从我所看到的这个错误似乎意味着.Net oracle驱动程序找不到oracle客户端。

有许多建议可以解决这个问题,包括检查PATH和ORACLE_HOME环境变量;在默认位置(C:\ oracle)重新安装oracle客户端(如果它尚不存在);或者使用oracle的Oracle Data Provider for .NET(ODP.NET)而不是Microsoft oracle驱动程序(System.Data.OracleClient)。

上述情况都没有解决我的问题,所以如果有人有任何建议,我们将非常欢迎!

答案 1 :(得分:2)

我们最近也遇到过这种情况;在我们的例子中,恢复ORACLE_HOME环境变量就行了(OMS10G的不完整安装使系统处于不一致状态,环境变量注册为null)。

答案 2 :(得分:0)

我在Windows 7机器上遇到过这种情况。在“windows xp sp3”兼容模式(文件/属性/兼容性)中添加ORACLE_HOME环境变量并运行使用oracle客户端的可执行文件为我解决了这个问题。

答案 3 :(得分:0)

虽然这个问题有点古老,但我会投入五美分。 从我在互联网上阅读的内容来看,即使在调用者(用户登录到Windows)无权读取/执行Oracle二进制文件时一直配置的环境中也会出现这种情况。

答案 4 :(得分:0)

从中删除System.Data.OracleClient.dll \Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5

请确保在出现任何其他错误时先备份

这对我有用。

或从以下文件夹中替换System.Data.OracleClient.dll Windows\Microsoft.NET\assembly\GAC_32\System.Data.OracleClient\v4.0_4.0.0.0__b77a5c561934e089