I am using asp.net mvc2 and mef to create pluggable architecture from this article When i deploy my project on real iis (7.0, windows 2008 server) i always got an mef exception at first request from client browser:
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:\de开发者_高级运维v\mef\MEF_SVN\tags\Preview6\src\ComponentModel\System\ComponentModel\Composition\ReflectionModel\ReflectionModelServices.cs:line 345
Cant understand how to fix it. Thanks for all responses and ideas.
Without a bit more code it's quite hard to debug. I would hazard a guess and say that you are using an early build of MEF (for the .NET v2.0/3.5 platform). I've done some previous work with ASP.NET MVC and MEF:
- Modular ASP.NET MVC using the Managed Extensibility Framework (MEF), Part One
- Modular ASP.NET MVC using the Managed Extensibility Framework (MEF), Part Two
- Modular ASP.NET MVC using the Managed Extensibility Framework (MEF), Part Three
and
- MVC3 and MEF
It's worth investigating the differences between these different implementations, and its also worth making sure you are actually using a version of MEF that is more or less feature complete (the one attached to my project above is an example).
精彩评论