ASP.NET错误,GAC已损坏

时间:2015-05-08 12:30:41

标签: c# asp.net visual-studio-2008 windows-7

我正在开发ASP.NET Web应用程序(C#)。当我重建我的解决方案时,这个过程比以前慢很多。我收到了这个错误。

path='\/backup\/'
sed -i "39s/.*/$path/" cluster.sh  # 39/.*/\/backup\//

我在IIS上的所有Web应用程序项目都会出现相同的错误。它以前工作正常。 我正在使用Visual Studio 2008,.NET Framework 3.5,并在Windows 7 32位上开发。

我尝试卸载.NET Framework 3.5并重新安装它但得到相同的错误。然后尝试使用NetFxTools并仍然得到相同的错误。有人可以帮我吗?

The module was expected to contain an assembly manifest. (Exception from HRESULT: 0x80131018) 
  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.BadImageFormatException: The module was expected to contain an assembly manifest. (Exception from HRESULT: 0x80131018)

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: 



[BadImageFormatException: The module was expected to contain an assembly manifest. (Exception from HRESULT: 0x80131018)]
   System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0
   System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +43
   System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +127
   System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +142
   System.Reflection.Assembly.Load(String assemblyString) +28
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +46

[ConfigurationErrorsException: The module was expected to contain an assembly manifest. (Exception from HRESULT: 0x80131018)]
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +613
   System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +57
   System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +178
   System.Web.Compilation.BuildProvidersCompiler..ctor(VirtualPath configPath, Boolean supportLocalization, String outputAssemblyName) +54
   System.Web.Compilation.ApplicationBuildProvider.GetGlobalAsaxBuildResult(Boolean isPrecompiledApp) +232
   System.Web.Compilation.BuildManager.CompileGlobalAsax() +51
   System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +337

[HttpException (0x80004005): The module was expected to contain an assembly manifest. (Exception from HRESULT: 0x80131018)]
   System.Web.Compilation.BuildManager.ReportTopLevelCompilationException() +58
   System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +512
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters) +729

[HttpException (0x80004005): The module was expected to contain an assembly manifest. (Exception from HRESULT: 0x80131018)]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +8994307
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +85
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +333




Version Information: Microsoft .NET Framework Version:2.0.50727.5485; ASP.NET Version:2.0.50727.5491 

1 个答案:

答案 0 :(得分:1)

如果你看到那里有一条消息说BadImageFormatException,那就意味着你有一种混合32位dll和64位dll。

检查你如何编译你的dll,尝试AnyCPU,检查你是否包含一些错误的dll,或者你的池是否在错误的cpu类型(例如必须是32位?)

您还可以阅读:
MSDN BadImageFormatException Class
BadImageFormatException Occurs When Instantiating Types Defined in a Referenced Assembly at Run-time