得到MissingMethodException是什么原因?

时间:2013-04-28 04:48:28

标签: asp.net-mvc-4 entity-framework-5

我在MVC 4项目上使用Entity Framework 5,我现在收到此错误..

'System.Data.Entity.DbSet`1<!!0> Pyroswarm.Infrastructure.EF.IContext.Set()'

这发生在这段代码中..

/// <summary>
/// Load your modules or register your services here!
/// </summary>
/// <param name="kernel">The kernel.</param>
private static void RegisterServices(IKernel kernel)
{
    // Chargement des modules du Framework Pyroswarm.
    kernel.Load("Pyroswarm.Providers.dll");

    // Chargement des modules de la solution.
    **kernel.Load("Pyroswarm.Pyw.Persistence.dll");** here
    kernel.Load("Pyroswarm.Pyw.Service.dll");
}      

堆栈追踪:

[MissingMethodException: Méthode introuvable : 'System.Data.Entity.DbSet`1<!!0> Pyroswarm.Infrastructure.EF.IContext.Set()'.]
   Ninject.Modules.AssemblyChecker.GetAssemblyNames(IEnumerable`1 filenames, Predicate`1 filter) in c:\Projects\Ninject\ninject\src\Ninject\Modules\AssemblyNameRetriever.cs:120
   Ninject.Modules.AssemblyNameRetriever.GetAssemblyNames(IEnumerable`1 filenames, Predicate`1 filter) in c:\Projects\Ninject\ninject\src\Ninject\Modules\AssemblyNameRetriever.cs:54
   Ninject.Modules.CompiledModuleLoaderPlugin.LoadModules(IEnumerable`1 filenames) in c:\Projects\Ninject\ninject\src\Ninject\Modules\CompiledModuleLoaderPlugin.cs:81
   Ninject.Modules.ModuleLoader.LoadModules(IEnumerable`1 patterns) in c:\Projects\Ninject\ninject\src\Ninject\Modules\ModuleLoader.cs:60
   Ninject.KernelBase.Load(IEnumerable`1 filePatterns) in c:\Projects\Ninject\ninject\src\Ninject\KernelBase.cs:236
   Ninject.ModuleLoadExtensions.Load(IKernel kernel, String[] filePatterns) in c:\Projects\Ninject\ninject\src\Ninject\Syntax\ModuleLoadExtensions.cs:54
   Pyroswarm.Pyw.MVC.UI.App_Start.NinjectWebCommon.RegisterServices(IKernel kernel) in e:\Pyroswarm\Pyroswarm.Pyw\Pyroswarm.Pyw.MVC.UI\App_Start\NinjectWebCommon.cs:64
   Pyroswarm.Pyw.MVC.UI.App_Start.NinjectWebCommon.CreateKernel() in e:\Pyroswarm\Pyroswarm.Pyw\Pyroswarm.Pyw.MVC.UI\App_Start\NinjectWebCommon.cs:50
   Ninject.Web.Common.Bootstrapper.Initialize(Func`1 createKernelCallback) in c:\Projects\Ninject\Ninject.Web.Common\src\Ninject.Web.Common\Bootstrapper.cs:50
   Pyroswarm.Pyw.MVC.UI.App_Start.NinjectWebCommon.Start() in e:\Pyroswarm\Pyroswarm.Pyw\Pyroswarm.Pyw.MVC.UI\App_Start\NinjectWebCommon.cs:26

[TargetInvocationException: Une exception a été levée par la cible d'un appel.]
   System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
   System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +192
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +108
   System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) +19
   WebActivator.BaseActivationMethodAttribute.InvokeMethod() +253
   WebActivator.ActivationManager.RunActivationMethods() +472
   WebActivator.ActivationManager.RunPreStartMethods() +27
   WebActivator.ActivationManager.Run() +42

[InvalidOperationException: La méthode d'initialisation de pré-démarrage de l'application Run de type WebActivator.ActivationManager a levé une exception avec le message d'erreur suivant : Une exception a été levée par la cible d'un appel..]
   System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection`1 methods, Func`1 setHostingEnvironmentCultures) +550
   System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +132
   System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath) +90
   System.Web.Compilation.BuildManager.ExecutePreAppStart() +135
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +516

[HttpException (0x80004005): La méthode d'initialisation de pré-démarrage de l'application Run de type WebActivator.ActivationManager a levé une exception avec le message d'erreur suivant : Une exception a été levée par la cible d'un appel..]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9873784
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254

知道这究竟是什么意思吗?

0 个答案:

没有答案