在IIS 7.0上部署ASP.NET MVC项目的问题。 BadImageFormatException

时间:2010-06-18 08:01:43

标签: asp.net-mvc configuration deployment

我被我的网络应用程序困住了。从标题中可以看出它是一个ASP.NET MVC(1,0)应用程序,所以我只需要做两件事,就像这样部署一个应用程序。我做了一个构建,将其复制到IIS文件夹。在IDE(VS2008)中一切正常:(。

这工作了很长时间。但是我知道我的另一个项目包含的dll出错了。 (我有一个德语版本,所以错误是从谷歌sry翻译的)

BadImageFormatException: File or assembly 'DataService.WebInterface.BusinessLogic "or one of its dependencies was not found. An attempt was made to load a file with an incorrect format.]
   System.Reflection.Assembly._nLoad (AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark & stackMark, throwOnFileNotFound Boolean, Boolean forIntrospection) +0
   System.Reflection.Assembly.InternalLoad (AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark & stackMark, Boolean forIntrospection) +416
   System.Reflection.Assembly.InternalLoad (String String assemblyName, Evidence assemblySecurity, StackCrawlMark & stackMark, Boolean forIntrospection) +166
   System.Reflection.Assembly.Load (String string assemblyName) +35
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper (String assemblyName, Boolean starDirective) +190

这是什么意思?文件是否已损坏或是否必须更改web.config?

感谢您的支持!

1 个答案:

答案 0 :(得分:2)

这可能意味着该项目的目标是与服务器环境不同的平台(x86 / x64)。在发布之前,更改VS中的目标平台以匹配您的服务器。 除此之外,应用程序池中的iis管理器中还有一个设置 - >名为“启用32位应用程序”的高级设置 - 如果在64位环境中使用32位组件(或本机程序集),则将其更改为“True”。