在ASP.NET MVC应用程序“坏二进制签名” [英] “Bad binary signature” in ASP.NET MVC application

查看:1071
本文介绍了在ASP.NET MVC应用程序“坏二进制签名”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到这里报告了同样的问题:<一href="http://stackoverflow.com/questions/2101529/bad-binary-signature-in-asp-net-mvc-application">"Bad二进制签名&QUOT;在ASP.NET MVC应用程序

I'm experiencing the same issue reported here: "Bad binary signature" in ASP.NET MVC application

在ASP.Net MVC的网站能正常工作在本地机器上,但是当使用aspnet_compiler,aspnet_merge和msdeploy的组合部署,加载任何网页都会失败,出现以下错误:

The ASP.Net MVC site works fine on the local machine, but when deployed using a combination of aspnet_compiler, aspnet_merge, and msdeploy, loading any page will fail with the following error:

System.BadImageFormatException   坏二进制签名。 (从HRESULT异常:0x80131192)

System.BadImageFormatException Bad binary signature. (Exception from HRESULT: 0x80131192)

在链接的问题,接受的解决方案表明,该问题是由使用了错误版本aspnet_merge引起的,而我已经验证去除部署aspnet_merge一步解决了这个问题。

The accepted solution in the linked question suggests that the issue is caused by using the wrong version of aspnet_merge, and I have verified that removing the aspnet_merge step from the deployment solves the issue.

我的问题是,使用正确的aspnet_merge版本没有出现解决问题。

My problem is that using the correct aspnet_merge version doesn't appear to resolve the issue.

Web应用程序是针对.NET 4.0中的64位。 所使用的aspnet_merge路径是:C:\ Program Files文件(x86)的\微软的SDK \的Windows \ v7.0A \ BIN \ NETFX 4.0工具\ aspnet_merge.exe

The web application is targeting .Net 4.0 64-bit. The aspnet_merge path used is: "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\aspnet_merge.exe"

本地开发是:

  • 在VS2010 SP1
  • 卡西尼
  • 64
  • VS11测试版和.NET 4.5的安装

构建路径是:

  • C:\ WINDOWS \ Microsoft.NET \框架\ v4.0.30319 \
  • C:\ Program Files文件(x86)的\ IIS \ Microsoft网站部署V2 \

推荐答案

我也遇到了类似的问题,使用Web部署项目以pre-编译ASP.NET网站项目中VS2010(.NET 4.0 )。

I've also experienced a similar issue using a Web Deployment Project to pre-compile an ASP.NET Web Site Project in VS2010 (.NET 4.0).

一切工作正常,直到我安装VS2012(安装.NET 4.5 - 我presume即相关),它开始给我:

Everything worked fine until I installed VS2012 (which installs .NET 4.5 - I presume that is related) which started giving me:

System.BadImageFormatException:坏二进制签名。 (从HRESULT异常:0x80131192)

在一些调试和隔离的测试情况下,我跟踪这个问题到了.NET 4.0网站和其他.NET 3.5的项目之间传递一个lambda。

After some debugging and isolated test cases I tracked the issue down to a lambda being passed between the .NET 4.0 web site and another .NET 3.5 project.

在3.5项目中定义的方法有这样的签名:

The method defined in the 3.5 project had a signature like this:

public IEnumberable<T> ExecuteAsEnumerable(Func<IDataReader, T> func)
{
  //..
}

这是作为一个在4.0网站的属性getter导致错误时通过aspnet_merge合并使用:

which was being used in the 4.0 website in a property getter resulting in the error when merged via aspnet_merge:

public IList<MyObject> MyListOfItems
{
  get
  { 
    return _myListOfItems ?? (_myListOfItems = new SomeQueryBuilder()
      //.build statement
      .ExecuteAsEnumerable(reader => new MyObject(reader))
      .ToArray());
  }
}

在我的测试情况下,我重新 ExecuteAsEnumerable 为4.0网站内的不同命名的扩展方法,pre-编译,和它的工作。检查项目的目标.NET框架,实现后为3.5(我以前没有意识到),我切换一切4.0,而一切又工作。

In my test case I recreated ExecuteAsEnumerable as an different named extension method inside the 4.0 web site, pre-compiled, and it worked. After checking the "Target .NET Framework" of the project and realising it was 3.5 (I hadn't realised before), I switched everything to 4.0, and everything worked again.

东西在.NET 4.5的更新(这是一个在就地升级过4.0)明显变化。就我而言,我可以重新编译该项目的问题 - 我不知道每个人都会有这样的奢侈(?是正确的字)

Something obviously changed in the .NET 4.5 update (which was an in place upgrade over 4.0). In my case I could recompile the project in question - I'm not sure everyone would have that luxury (is that the right word?).

希望有所帮助。

这篇关于在ASP.NET MVC应用程序“坏二进制签名”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆