C#ASP.NET" InvalidProgramException:公共语言运行时检测到无效的程序"

时间:2015-03-28 16:02:26

标签: c# asp.net asp.net-mvc .net-4.5 invalidprogramexception

我正在尝试使用.NET 4.5“开始调试”ASP.NET MVC Web应用程序并以“任何CPU”为目标,从而获得上述异常。我发现的关于这个问题的所有其他问题似乎都确切地知道应用程序在哪里引起了问题,但是堆栈跟踪对我来说没有任何意义,因为它没有提到任何我自己编写的代码(见下文: )

[InvalidProgramException: Common Language Runtime detected an invalid program.]
   System.Windows.Markup.XmlnsPrefixAttribute..ctor(String xmlNamespace, String prefix) +0
   System.Reflection.CustomAttribute._CreateCaObject(RuntimeModule pModule, IRuntimeMethodInfo pCtor, Byte** ppBlob, Byte* pEndBlob, Int32* pcNamedArgs) +0
   System.Reflection.CustomAttribute.CreateCaObject(RuntimeModule module, IRuntimeMethodInfo ctor, IntPtr& blob, IntPtr blobEnd, Int32& namedArgs) +38
   System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent) +589
   System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType) +103
   System.Reflection.RuntimeAssembly.GetCustomAttributes(Boolean inherit) +33
   Owin.Loader.DefaultLoader.SearchForStartupAttribute(String friendlyName, IList`1 errors, Boolean& conflict) +294
   Owin.Loader.DefaultLoader.GetDefaultConfiguration(String friendlyName, IList`1 errors) +105
   Owin.Loader.DefaultLoader.LoadImplementation(String startupName, IList`1 errorDetails) +161
   Owin.Loader.DefaultLoader.Load(String startupName, IList`1 errorDetails) +51
   Microsoft.Owin.Host.SystemWeb.OwinBuilder.GetAppStartup() +238
   Microsoft.Owin.Host.SystemWeb.OwinHttpModule.InitializeBlueprint() +103
   System.Threading.LazyInitializer.EnsureInitializedCore(T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory) +86
   System.Threading.LazyInitializer.EnsureInitialized(T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory) +72
   Microsoft.Owin.Host.SystemWeb.OwinHttpModule.Init(HttpApplication context) +104
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +418
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296

[HttpException (0x80004005): Common Language Runtime detected an invalid program.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9930568
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254

有人能告诉我如何找出抛出异常的地点和时间吗?它甚至不会在抛出之前加载主页,也不会破坏startup.cs文件的代码,所以我没有太多可以继续下去。

我对ASP.NET MVC开发还不熟悉,因此调试之前未遇到过的异常非常困难,我真的很感激有关此事的任何帮助!

更新:我正在尝试使用Windows 8.1 Professional 64位计算机上的IIS Express在Firefox中运行Visual Studio 2013中创建的Web应用程序,该配置与一周前用于同一Web应用程序的配置相同。从那时起,我对MVC模型和控制器进行了更改,但没有改变任何会影响其部署/调试的程度。我只需要知道如何获得有关异常抛出位置的更多信息。

1 个答案:

答案 0 :(得分:0)

有一个article on Microsoft site

主要原因是您尝试在基于Windows XP的环境上运行程序。

  

错误代码0x80004005

     

如果Windows Product Activation (WPA)所需的文件已损坏或丢失,则可能会出现此问题。如果一个或   满足以下两个条件:     - 第三方备份实用程序或防病毒程序会干扰Windows XP的安装。     - 手动修改WPA所需的文件。