我正在使用像Simple.DataDatabase.Default.Licenses.All().ToList<License>()
这样的简单数据(1.0.0-rc0)来获取许可证列表。它在我的制作环境(VS2010,IIS7.5)中工作正常,但一旦部署到实时服务器就抛出:
`System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.Assembly.GetTypes()
at System.ComponentModel.Composition.Hosting.AssemblyCatalog.get_InnerCatalog()
at System.ComponentModel.Composition.Hosting.AssemblyCatalog.GetExports(ImportDefinition definition)
at System.ComponentModel.Composition.Hosting.AggregateCatalog.GetExports(ImportDefinition definition)
at System.ComponentModel.Composition.Hosting.CatalogExportProvider.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ExportProvider.GetExports(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.AggregateExportProvider.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable1& exports)
at System.ComponentModel.Composition.Hosting.CompositionContainer.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ExportProvider.GetExports(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ExportProvider.GetExportsCore[T](String contractName)
at Simple.Data.MefHelper.Compose[T](String contractName)
at Simple.Data.AdapterFactory.DoCreate(String adapterName, IEnumerable1 settings)
at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 valueFactory)
at Simple.Data.CachingAdapterFactory.Create(String adapterName, IEnumerable1 settings)
at Simple.Data.DatabaseOpener.OpenDefaultMethod()
at Simple.Data.DatabaseOpener.OpenDefault()`
`System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.Shell, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.VisualStudio.Shell, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'`
服务器正在运行一个刚刚安装的Windows Server 2008 R2。过去两天我一直在进行此操作而没有任何进展。在服务器设置期间,我是否可能遗漏了一些重要的东西?
答案 0 :(得分:2)
这是MEF的一个问题。 bin文件夹中的一个程序集引用了Microsoft.VisualStudio.Shell,当MEF尝试执行其操作并且无法跟踪所有引用时,它会抛出该错误。
这是最近几个错误报告的原因,下一个版本将对MEF代码进行更改,以防止它发生。
作为此时的解决方法,您可以使用引用跟踪程序集并将其删除,或将该程序集放在bin文件夹中。我推荐前者,因为添加该程序集可能是整个链添加越来越多的开始。