本文介绍了试图读取或在.NET应用程序写入受保护的内存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我具有实施和IIS 6服务器ASP NET应用程序的烦恼。

I'm having troubles at implementing and ASP .Net Application in IIS 6 Server.

当用户试图打开一个网页,访问数据库,IIS服务器抛出尝试读取或写入受保护的内存这是堆栈跟踪:

When the user tries to open a web page that access the database, iis server throws "Attempted to read or write protected memory" this is the StackTrace:

System.AccessViolationException:尝试读取或写入保护
  记忆。这通常是指示其他内存已损坏。
      在Oracle.DataAccess.Client.OpsPrm.ResetValCtx(OpoPrmValCtx * pOpoPrmValCtx,的Int32 ctxSize)
      在Oracle.DataAccess.Client.OracleParameter.ResetCtx(的Int32 ARRAYSIZE)
      在Oracle.DataAccess.Client.OracleParameter。preBind(为OracleConnection
  康涅狄格州,IntPtr的errCtx,的Int32 ARRAYSIZE)
      在Oracle.DataAccess.Client.OracleCommand.ExecuteReader(布尔重新查询,布尔fillRequest,行为的CommandBehavior)
      在Oracle.DataAccess.Client.OracleCommand.ExecuteReader()
      在Oracle.DataAccess.Client.OracleCommand.ExecuteScalar()
      在Tenaris.FSA.OracleProvider.OracleProvider.ExecuteScalar(字符串commandToExecute,的CommandType命令类型,的DbParameter []参数)
  在C:\\ CONGELADOS FSA \\ FSA 1er酒店Entregable
  05052013 \\ Tenaris.FSA.OracleProvider \\ OracleProvider.cs:223线
      在Tenaris.FSA.DAC.Providers.DataAccessManager.ExecuteScalar(字符串
  commandToExecute,的CommandType命令类型,的DbParameter []参数)
  在C:\\ CONGELADOS FSA \\ FSA 1er酒店Entregable
  05052013 \\ Tenaris.FSA.DataAccessComponent \\供应商\\ DataAccessManager.cs:行
  59
      在Tenaris.FSA.DAC.Repository.AppointmentWayClientDAL.GetCountRegisters(布尔
  用C onlyEnabled):\\ CONGELADOS FSA \\ FSA 1er酒店Entregable
  05052013 \\ Tenaris.FSA.DataAccessComponent \\库\\ AppointmentWayClientDAL.cs:行
  39
      在Tenaris.FSA.BusinessComponents.BusinessProcess.AppointmentWayClientManager.GetCountRegisters(布尔
  用C onlyEnabled):\\ CONGELADOS FSA \\ FSA 1er酒店Entregable
  05052013 \\ Tenaris.FSA.BusinessComponents \\ BusinessProcess \\ AppointmentWayClientManager.cs:行
  28

什么是罕见的,因为是不应该的错误出现在管理code和网站的previous版本是工作的罚款。我已经做了多次试验,就像在x86平台的PC编译应用程序,复制从功能版本的web.config文件,复制从功能版本Oracle.DataAccess DLL,但错误依然呈现。

What's rare, because that error is not supposed to appear in managed code, and the previous version of the site is working fine. I've done several tests, like compiling the app in an x86 platform pc, copied the web.config from the functional version, copied the Oracle.DataAccess dll from the functional version, but the error still showing.

你应该知道的另一件事情是,有,在填充一个DropDownList实际上succeded一个页面,但随后的页面必须填写一个gridview并有出现以上异常。

Another thing you should know is that there is a page that, actually succeded in filling a dropdownlist, but then the page has to fill a gridview and there appears the above exception.

推荐答案

我终于可以解决这一问题,另一位开发人员使用的使用的条款,同时创造OracleParameters,它是这样的:

I could finally solve the issue, another developer used a "using" clause while creating OracleParameters, it was like:

using(OracleParameter prm = SomeMethodThatCreatesIt(value,paramName))
{
 //extracode
 myCommand.Parameters.Add(prm);
}

所以,code只好更改为:

So the code had to change to:

OracleParameter prm = SomeMethodThatCreatesIt(value,paramName);
//extracode
myCommand.Parameters.Add(prm);

正如你可以在堆栈跟踪看到,问题是在对参数的一些过程。

As you can see in the stacktrace, the problem were at some process for parameters.

因此​​,code,采用前处置的对象。我不能理解的是,这是为什么即使在是我的测试一个控制台应用程序工作,但也被现在的工作,谢谢大家。

So, The code was Disposing the object before using it. What I can't understand is why is this even working in a console application that was one of my tests, but well it is working now, Thank you everyone

这篇关于试图读取或在.NET应用程序写入受保护的内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-08 06:21