当打开一个Oracle连接

当打开一个Oracle连接

本文介绍了当打开一个Oracle连接,连接对象为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图连接到Oracle数据库在我的控制器:

 使用Oracle.DataAccess.Client;
 使用Oracle.DataAccess.Types;

 //其他code

 为OracleConnection CON;
 CON =新的OracleConnection();

 con.ConnectionString =数据来源=< D​​SOURCE_NAME取代;持续安全信息= TRUE;用户ID = ******; PASSWORD = *******;

 con.Open();
 

连接测试是成功的,我可以通过表,函数等,Visual Studio的服务器资源管理器浏览,但是当我试图执行上面的code我一直让 [NullReferenceException异常:对象。引用不设置到对象的实例] con.Open();

这是我第一次使用ODP为.NET和我一般新的C#和。什么可能是这个问题的任何想法?

堆栈跟踪:

 源错误:


第27行:
第28行:
第29行:con.Open();
第30行:

源文件:C:\ Program Files文件\项目\来源\项目\项目\区\自定义\控制器\ HomeController.cs线:29

 堆栈跟踪:


    [NullReferenceException:未将对象引用不设置到对象的实例。]
   Oracle.DataAccess.Client.OracleConnection.Open()12156
   Project.Areas.Custom.Controllers.HomeController.Id()在C:\ Program Files文件\项目\来源\项目\项目\区\自定义\控制器\ HomeController.cs:29
   lambda_method(封闭,ControllerBase,对象[])+101
   System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase控制器,对象[]参数)+59
   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext,IDictionary`2参数)435
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext,ActionDescriptor actionDescriptor,IDictionary`2参数)+60
   System.Web.Mvc.Async.ActionInvocation.InvokeSynchronousActionMethod()+76
   System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult,ActionInvocation innerInvokeState)+36
   System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult的asyncResult)+73
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End()+136
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult的asyncResult,对象标签)+102
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult的asyncResult)+49
   System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() +117
   System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() 323
   System.Web.Mvc.Async.<>c__DisplayClass33.<BeginInvokeActionMethodWithFilters>b__32(IAsyncResult asyncResult)+44
   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult的asyncResult)+47
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End()+136
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult的asyncResult,对象标签)+102
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult的asyncResult)+50
   System.Web.Mvc.Async&LT;&GT; c__DisplayClass2b&LT; BeginInvokeAction&GT; b__1c()+72
   System.Web.Mvc.Async&LT;&GT;。c__DisplayClass21&LT; BeginInvokeAction&GT; b__1e(IAsyncResult的asyncResult)+185
   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult的asyncResult)+42
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End()+133
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult的asyncResult,对象标签)+56
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult的asyncResult)+ 40
   System.Web.Mvc.Controller&LT; BeginExecuteCore&GT; b__1d(IAsyncResult的asyncResult,ExecuteCoreState innerState)+34
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult的asyncResult)+ 70
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End()+133
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult的asyncResult,对象标签)+56
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult的asyncResult,对象标签)+37
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult的asyncResult)+44
   System.Web.Mvc.Controller&LT; BeginExecute&GT; b__15(IAsyncResult的asyncResult,控制器控制器)+39
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult的asyncResult)+62
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End()+133
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult的asyncResult,对象标签)+56
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult的asyncResult,对象标签)+37
   System.Web.Mvc.Controller.EndExecute(IAsyncResult的asyncResult)+39
   System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult的asyncResult)+39
   System.Web.Mvc.MvcHandler&LT; BeginProcessRequest&GT; b__5(IAsyncResult的asyncResult,ProcessRequestState innerState)+39
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult的asyncResult)+ 70
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End()+133
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult的asyncResult,对象标签)+56
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult的asyncResult,对象标签)+37
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult的asyncResult)+ 40
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult的结果)+38
   System.Web.Mvc&LT;&GT; c__DisplayClassa&LT; EndProcessRequest&GT; b__9()+44
   System.Web.Mvc&LT;&GT; c__DisplayClass4&LT;总结&GT; b__3()+34
   System.Web.Mvc.ServerExecuteHttpHandlerWrapper.Wrap(Func`1 FUNC)+69
   System.Web.Mvc.ServerExecuteHttpHandlerWrapper.Wrap(动作行为)+123
   System.Web.Mvc.ServerExecuteHttpHandlerAsyncWrapper.EndProcessRequest(IAsyncResult的结果)+133
   System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler的处理程序,TextWriter的作家,布尔preserveFor​​m,布尔集previousPage,VirtualPath路径,VirtualPath文件路径,字符串physPath,异常错误,字符串queryStringOverride)1556

[HttpException(0X80004005):错误执行的处理程序System.Web.Mvc.HttpHandlerUtil + ServerExecuteHttpHandlerAsyncWrapper'子请求]
   System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler的处理程序,TextWriter的作家,布尔preserveFor​​m,布尔集previousPage,VirtualPath路径,VirtualPath文件路径,字符串physPath,异常错误,字符串queryStringOverride)3424518
   System.Web.HttpServerUtility.Execute(IHttpHandler的处理程序,TextWriter的作家,布尔preserveFor​​m,布尔集previousPage)+77
   System.Web.HttpServerUtility.Execute(IHttpHandler的处理程序,TextWriter的作家,布尔preserveFor​​m)+29
   System.Web.HttpServerUtilityWrapper.Execute(IHttpHandler的处理程序,TextWriter的作家,布尔preserveFor​​m)+24
   System.Web.Mvc.Html.ChildActionExtensions.ActionHelper(HtmlHelper的HtmlHelper的,字符串actionName,字符串controllerName,RouteValueDictionary routeValues​​,TextWriter的TextWriter的)+977
   System.Web.Mvc.Html.ChildActionExtensions.Action(HtmlHelper的HtmlHelper的,字符串actionName,字符串controllerName,RouteValueDictionary routeValues​​)+112
   System.Web.Mvc.Html.ChildActionExtensions.Action(HtmlHelper的HtmlHelper的,字符串actionName,字符串controllerName)+47
   ASP._Page_Areas_Custom_Views_Home_Home_cshtml.Execute()在C:\ Program Files文件\项目\来源\项目\项目\区\自定义\查看\首页\ Home.cshtml:13
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy()+270
   System.Web.Mvc.WebViewPage.ExecutePageHierarchy()+122
   System.Web.WebPages.StartPage.RunPage()+63
   System.Web.WebPages.StartPage.ExecutePageHierarchy()+100
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext的,TextWriter的作家,WebPageRenderingBase起始页)+131
   System.Web.Mvc.RazorView.RenderView(ViewContext viewContext,TextWriter的作家,对象实例)695
   System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext,TextWriter的作家)+382
   System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext上下文)431
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext,的ActionResult的ActionResult)+39
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1过滤器,的Int32 filterIndex,ResultExecutingContext preContext,ControllerContext controllerContext,的ActionResult的ActionResult)+116
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1过滤器,的Int32 filterIndex,ResultExecutingContext preContext,ControllerContext controllerContext,的ActionResult的ActionResult)529
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext,IList`1过滤器,的ActionResult的ActionResult)+106
   System.Web.Mvc.Async&LT;&GT;。c__DisplayClass2b&LT; BeginInvokeAction&GT; b__1c()+321
   System.Web.Mvc.Async&LT;&GT;。c__DisplayClass21&LT; BeginInvokeAction&GT; b__1e(IAsyncResult的asyncResult)+185
   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult的asyncResult)+42
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End()+133
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult的asyncResult,对象标签)+56
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult的asyncResult)+ 40
   System.Web.Mvc.Controller&LT; BeginExecuteCore&GT; b__1d(IAsyncResult的asyncResult,ExecuteCoreState innerState)+34
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult的asyncResult)+ 70
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End()+133
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult的asyncResult,对象标签)+56
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult的asyncResult,对象标签)+37
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult的asyncResult)+44
   System.Web.Mvc.Controller&LT; BeginExecute&GT; b__15(IAsyncResult的asyncResult,控制器控制器)+39
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult的asyncResult)+62
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End()+133
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult的asyncResult,对象标签)+56
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult的asyncResult,对象标签)+37
   System.Web.Mvc.Controller.EndExecute(IAsyncResult的asyncResult)+39
   System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult的asyncResult)+39
   System.Web.Mvc.MvcHandler&LT; BeginProcessRequest&GT; b__5(IAsyncResult的asyncResult,ProcessRequestState innerState)+39
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult的asyncResult)+ 70
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End()+133
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult的asyncResult,对象标签)+56
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult的asyncResult,对象标签)+37
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult的asyncResult)+ 40
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult的结果)+38
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()9711525
   System.Web.HttpApplication.ExecuteStep(IExecutionStep步骤,布尔和放大器; completedSynchronously)+155
 

解决方案

添加一个try catch块周围的open()调用和解决ORA错误显示在OracleException。

I am trying to connect to an oracle database in my controller:

 using Oracle.DataAccess.Client;
 using Oracle.DataAccess.Types;

 // Other code

 OracleConnection con;
 con = new OracleConnection();

 con.ConnectionString = "DATA SOURCE=<DSOURCE_NAME>;PERSIST SECURITY INFO=True;USER ID=******;PASSWORD=*******";

 con.Open();

The connection test is successful and I can navigate through tables, functions, etc. in Visual Studio's Server Explorer, but when I try to execute the above code I consistently get[NullReferenceException: Object reference not set to an instance of an object.] on the con.Open(); line.

This is my first time using ODP for .NET and I am generally new to C# as well. Any ideas on what could be the problem?

Stack Trace:

    Source Error:


Line 27:
Line 28:
Line 29:             con.Open();
Line 30:

Source File: c:\Program Files\Project\source\Project\Project\Areas\Custom\Controllers\HomeController.cs    Line: 29

 Stack Trace:


    [NullReferenceException: Object reference not set to an instance of an object.]
   Oracle.DataAccess.Client.OracleConnection.Open() +12156
   Project.Areas.Custom.Controllers.HomeController.Id() in c:\Program Files\Project\source\Project\Project\Areas\Custom\Controllers\HomeController.cs:29
   lambda_method(Closure , ControllerBase , Object[] ) +101
   System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +59
   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +435
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +60
   System.Web.Mvc.Async.ActionInvocation.InvokeSynchronousActionMethod() +76
   System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +36
   System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) +73
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +136
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +102
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +49
   System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() +117
   System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +323
   System.Web.Mvc.Async.<>c__DisplayClass33.<BeginInvokeActionMethodWithFilters>b__32(IAsyncResult asyncResult) +44
   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +47
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +136
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +102
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +50
   System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +72
   System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +185
   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +42
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +133
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +56
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +40
   System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +34
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +70
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +133
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +56
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +37
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +44
   System.Web.Mvc.Controller.<BeginExecute>b__15(IAsyncResult asyncResult, Controller controller) +39
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +62
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +133
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +56
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +37
   System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +39
   System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +39
   System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +39
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +70
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +133
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +56
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +37
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +40
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +38
   System.Web.Mvc.<>c__DisplayClassa.<EndProcessRequest>b__9() +44
   System.Web.Mvc.<>c__DisplayClass4.<Wrap>b__3() +34
   System.Web.Mvc.ServerExecuteHttpHandlerWrapper.Wrap(Func`1 func) +69
   System.Web.Mvc.ServerExecuteHttpHandlerWrapper.Wrap(Action action) +123
   System.Web.Mvc.ServerExecuteHttpHandlerAsyncWrapper.EndProcessRequest(IAsyncResult result) +133
   System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride) +1556

[HttpException (0x80004005): Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper'.]
   System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride) +3424518
   System.Web.HttpServerUtility.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage) +77
   System.Web.HttpServerUtility.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm) +29
   System.Web.HttpServerUtilityWrapper.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm) +24
   System.Web.Mvc.Html.ChildActionExtensions.ActionHelper(HtmlHelper htmlHelper, String actionName, String controllerName, RouteValueDictionary routeValues, TextWriter textWriter) +977
   System.Web.Mvc.Html.ChildActionExtensions.Action(HtmlHelper htmlHelper, String actionName, String controllerName, RouteValueDictionary routeValues) +112
   System.Web.Mvc.Html.ChildActionExtensions.Action(HtmlHelper htmlHelper, String actionName, String controllerName) +47
   ASP._Page_Areas_Custom_Views_Home_Home_cshtml.Execute() in c:\Program Files\Project\source\Project\Project\Areas\Custom\Views\Home\Home.cshtml:13
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +270
   System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +122
   System.Web.WebPages.StartPage.RunPage() +63
   System.Web.WebPages.StartPage.ExecutePageHierarchy() +100
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +131
   System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +695
   System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +382
   System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +431
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +39
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +116
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +529
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +106
   System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +321
   System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +185
   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +42
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +133
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +56
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +40
   System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +34
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +70
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +133
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +56
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +37
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +44
   System.Web.Mvc.Controller.<BeginExecute>b__15(IAsyncResult asyncResult, Controller controller) +39
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +62
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +133
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +56
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +37
   System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +39
   System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +39
   System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +39
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +70
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +133
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +56
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +37
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +40
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +38
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9711525
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
解决方案

Add a try catch block around the open() call and resolve the ORA error that shows up in the OracleException.

这篇关于当打开一个Oracle连接,连接对象为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 06:49