简体   繁体   English

ASP.NET:找不到ICollection构造函数吗?

[英]ASP.NET: ICollection Constructor Not Found?

I have a ASP.NET application running on a remote web server and I just started getting this error. 我有一个在远程Web服务器上运行的ASP.NET应用程序,而我刚开始遇到此错误。 I can't seem to reproduce it in my development environment: 我似乎无法在开发环境中重现它:

Method not found: 'Void System.Collections.Generic.ICollection`1..ctor()'.

Could this be due to some misconfiguration of .NET Framework or IIS 6? 这可能是由于.NET Framework或IIS 6的某些错误配置引起的吗?

Update: I disassembled the code in the DLL and it seems like the compiler is incorrectly optimizing the code. 更新:我反汇编了DLL中的代码,似乎编译器错误地优化了代码。 (Note that Set is a class that implements a set of unique objects. It inherits from IEnumerable.) This line: (请注意,Set是一个实现一组唯一对象的类。它继承自IEnumerable。)此行:

Set<int> set = new Set<int>();

Is compiled into this line: 编译成这一行:

Set<int> set = (Set<int>) new ICollection<CalendarModule>();

The Calendar class is a totally unrelated class!! 日历类是完全无关的类! Has anyone ever noticed .NET incorrectly compiling code like this before? 有没有人注意到.NET以前不正确地编译这样的代码?

Are the .NET versions on both systems the same inc. 两个系统上的.NET版本是否相同? the same service pack? 相同的服务包?

Is your IIS setup to use .NET 2.0? 您的IIS设置是否使用.NET 2.0? If not, change it to 2.0. 如果不是,请将其更改为2.0。 If you can't see 2.0 in the list then you'll need to run aspnet_regiis from the 2.0 framework directory. 如果在列表中看不到2.0,则需要从2.0框架目录运行aspnet_regiis。

This was caused by a bug in the aspnet merge tool which incorrectly merged optimized assemblies. 这是由于aspnet合并工具中的错误导致错误地合并了优化的程序集。 It can be solved by either not merging the assemblies or not optimizing them. 可以通过不合并部件或不优化它们来解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM