简体   繁体   中英

System.Reflection.TargetInvocationException when i run MVC 4 application

Suddenly i'm not able to my mvc4 application. I didn't do any change in the code. any idea where and how can i solve this issue? or have more information to trace this issue?

I restarted my PC a couple of times, also checked these articles

  1. Stackoverflow
  2. Ms

They suggest to check the part of code that causes this. but in my case i don't even arrive to any of my code.

The folder mentioned by Intelitrace is empty:

C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\Temporary ASP.NET Files

Inner exception message:

Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

error:

System.Reflection.TargetInvocationException was unhandled
HResult=-2146232828 Message=Exception has been thrown by the target of an invocation. Source=mscorlib StackTrace: at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) at System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection 1 methods, Func 1 setHostingEnvironmentCultures) at System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) at System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) at System.Web.Compilation.BuildManager.ExecutePreAppStart() at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory co nfigMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel) at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel) at System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironment(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters) at System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironmentAndReportErrors(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters) at System.Web.Hosting.ApplicationManager.GetAppDomainWithHostingEnvi ronment(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters) at System.Web.Hosting.ApplicationManager.CreateObjectInternal(String appId, Type type, IApplicationHost appHost, Boolean failIfExists, HostingEnvironmentParameters hostingParameters) at System.Web.Hosting.ProcessHost.StartApplication(String appId, String appPath, Object& runtimeInterface) InnerException: System.AccessViolationException HResult=-2147467261 Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt. StackTrace: InnerException:

在此处输入图片说明

A similar issue was solved here

Finally tracked this down with the help of WinDBG and SOS. Access violation was being thrown by some unknown DLL. Turns out a piece of software called "Nvidia Network Manager" was causing the problems. I'd read countless times how this issue can be caused by firewalls or antivirus, neither of which I am using so I dismissed this idea. Also, I was under the assumption that it was not environmental because it occurs on more than 1 server using different hardware. Turns out all the machines I tested this on were running "NVidia Network Manager". I believe it installs with the rest of the motherboard drivers.

Which may be an issue that is outside of your application. In this guy's case there's a bad software that's affecting his application. You might wanna try tracking it with the tools he mentioned. Good luck!

Ok, here is how i solved this issue,

  1. Uninstall Visual studio 2012
  2. Uninstall all .NET .
  3. Restart
  4. Install Latest .Net
  5. Install Visual studio 2012

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM