我是一名开发人员,试图将旧的ASP.Net StoreFront网站更新到足以让我在本地计算机上运行。但是,我得到了这个问题:
[AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.]
我试过了:
该网站不仅在我的计算机上损坏,而且在生产网站上也出现了相同的错误。
我正在处理的网站是专有的,我受到保密协议的约束,因此我无法发布代码段。有没有人有任何建议?
编辑:我可以访问源代码。如果我运行该项目,它会在Global.asax.cs文件中运行方法时抛出错误。如果我对此进行评论,它只会抛出相同的错误而没有目标。
编辑:1。代码中没有找到DllImport或unsafe。
我正在使用IISExpress,我可以附加到IISExpress进程
[AccessViolationException:尝试读取或写入受保护的内存。这通常表明其他内存已损坏。 c:\ Dev \ Web \ App_Code \ Global.asax.cs:222中的AspDotNetStorefront.Global.InitializeComponent()] c:\ Dev \ Web \ App_Code \ Global.asax.cs中的AspDotNetStorefront.Global..ctor():35 ASP.global_asax..ctor()在c:\ AppData \ Local \ Temp \ Temporary ASP.NET Files \ root \ 47c1f925 \ 38c0005 \ App_global.asax.inuh90ct.0.cs:0
[TargetInvocationException:调用目标抛出了异常。] System.RuntimeTypeHandle.CreateInstance(RuntimeType类型,Boolean publicOnly,Boolean noCheck,Boolean& canBeCached,RuntimeMethodHandle& ctor,Boolean& bNeedSecurityCheck)+0 System.RuntimeType.CreateInstanceSlow(Boolean publicOnly,Boolean fillCache)+86 System.RuntimeType.CreateInstanceImpl(Boolean publicOnly,Boolean skipVisibilityChecks,Boolean fillCache)+230 System.Activator.CreateInstance(Type type,Boolean nonPublic)+67 System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr,Binder binder,Object [] args,CultureInfo culture,Object [] activationAttributes)+1051 System.Activator.CreateInstance(Type type,BindingFlags bindingAttr,Binder binder,Object [] args,CultureInfo culture,Object [] activationAttributes)+111 System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext,HttpContext context)+215 System.Web.HttpApplicationFactory.FireApplicationOnStart(HttpContext context)+8984344 System.Web.HttpApplicationFactory.EnsureAppStartCalled(HttpContext context)+136 System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context)+92 System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)+289]
如果我将当前被指向的函数调用注释为源,这是我得到的错误:
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
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.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
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:
[AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.]
System.Web.Mobile.ErrorHandlerModule..ctor() +0
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) +0
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache) +86
System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache) +230
System.Activator.CreateInstance(Type type, Boolean nonPublic) +67
System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +1051
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +111
System.Web.Configuration.Common.ModulesEntry.Create() +39
System.Web.Configuration.HttpModulesSection.CreateModules() +164
System.Web.HttpApplication.InitModules() +28
System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers) +729
System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context) +298
System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context) +107
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +289
答案 0 :(得分:1)
解决方案:ASPDNSF 7.0与ASP.Net>不兼容2.0
http://forumarchive.vortx.com/threads/26485-Attempted-to-read-or-write-protected-memory.html 上一篇文章
他们都指向asp.net 3.5 sp1和.net 3.5 sp1,这是导致尝试阅读的错误.....错误
答案 1 :(得分:0)
[DllImport
和unsafe
。我已经看到这个错误弹出,例如,使用非线程安全的非托管库。要将调试程序附加到w3wp,您必须确保以管理员身份运行Visual Studio,并且必须在部署网站的计算机上运行它至。这个过程应该让您更好地了解导致AccessViolation的原因,并允许更好的研究/提问。