我将解决方案ElasticSearch.net和嵌套库升级到7.1.0版本。
部署代码后,出现以下错误:
BadImageFormatException: Could not load file or assembly 'netstandard' or one of its dependencies. Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context. (Exception from HRESULT: 0x80131058)
System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +225
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +110
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +22
System.Reflection.Assembly.Load(String assemblyString) +34
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +48
我试图将库复制到我部署的服务器上,但这不起作用。
升级详情:
1.)ElasticSearch.net 5.6.1至7.1.0
2.)巢5.6.1至7.1.0
3.)安装了.NetFramework 4.7.3
4.)VS2017
从nuget软件包管理器升级。
最佳答案
通过在csproj文件中手动添加netstandard库的引用已解决了该问题,如下所示:
<Reference Include="netstandard">
<Private>True</Private>
</Reference>
上述解决方法是从-You must add a reference to assembly 'netstandard, Version=2.0.0.0提供的
关于elasticsearch - 无法加载文件或程序集 'netstandard'或其依赖项之一,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/57912454/