当我尝试访问IIS 7.0中的网站(使用Windows Server 2008上的VSTS 2010 + .Net 4.0开发)中的页面(default.aspx)时,我遇到以下错误消息.有什么想法有什么不对?BadImageFormatException是什么意思?
顺便说一句:我运行Windows Server 2008 64位(不是R2)并且还没有激活Windows Server 2008,它可能是根本原因吗?
[BadImageFormatException: Could not load file or assembly 'test.foo' or one of its dependencies. Try to load bad formatted program. ] System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0 System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks) +567 System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +192 System.Reflection.Assembly.Load(String assemblyString) +35 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +118 [ConfigurationErrorsException: …
我在VS 2005中编写了一个dll,它将由另一个在VS 2003中开发的程序加载.当该程序试图加载我的dll时,它会抛出一个System.BadImageFormatException: The format of the file 'Foo.dll' is invalid.
我搜索了SO和谷歌,似乎不同版本的.NET是罪魁祸首.我的问题是:我该如何解决这个问题?
(我无法修改VS 2003中开发的程序.)