2011-08-10 30 views
1

我使用asp.net mvc2和mef创建可插拔架构this article 当我在真正的iis(7.0,windows 2008服务器)上部署我的项目时,我总是得到在客户浏览器的第一次请求时出现mef异常:asp.net mvc 2和mef奇怪的异常在iis开始

global.asax 
System.NullReferenceException: Object reference not set to an instance of an object. 
    at System.Lazy`1.get_Value() in c:\dev\mef\MEF_SVN\tags\Preview6\src\ComponentModel\System\Lazy.cs:line 61 
    at System.ComponentModel.Composition.ReflectionModel.ReflectionModelServices.LazyExportDefinition.get_Metadata() in c:\dev\mef\MEF_SVN\tags\Preview6\src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ReflectionModelServices.cs:line 345 

不能理解如何解决它。感谢所有的回应和想法。

回答

2

没有更多的代码就很难调试。我会冒险猜测,并说你正在使用MEF的早期版本(用于.NET v2.0/3.5平台)。我已经做了ASP.NET MVC和MEF一些前期工作:

  1. Modular ASP.NET MVC using the Managed Extensibility Framework (MEF), Part One
  2. Modular ASP.NET MVC using the Managed Extensibility Framework (MEF), Part Two
  3. Modular ASP.NET MVC using the Managed Extensibility Framework (MEF), Part Three

  1. MVC3 and MEF

这是值得研究这些不同的实现之间的差异,而且它也值得确保你实际上使用的是一个或多或少功能完整的MEF版本(附在我上面的项目中的一个是一个例子)。

+0

非常感谢。我会尝试一个新版本,谢谢 –