System.Reflection.ReflectionTypeloadexception:'无法加载一种或多种请求的类型。无法加载文件或组装
我正在Visual Studio 2019 Net5.0上构建API,当我的程序突然停止工作时,我只是添加了最后的控制器和验证器。
我遇到的错误:
System.Reflection.ReflectionTypeLoadException: 'Unable to load one or more of the requested types.
Could not load file or assembly 'Crijoya.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Se ha intentado cargar un programa con un formato incorrecto.
Could not load file or assembly 'Crijoya.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Se ha intentado cargar un programa con un formato incorrecto.
Could not load file or assembly 'Crijoya.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Se ha intentado cargar un programa con un formato incorrecto.
Could not load file or assembly 'Crijoya.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Se ha intentado cargar un programa con un formato incorrecto.
Could not load file or assembly 'Crijoya.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Se ha intentado cargar un programa con un formato incorrecto.
Could not load file or assembly 'Crijoya.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Se ha intentado cargar un programa con un formato incorrecto.
Could not load file or assembly 'Crijoya.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Se ha intentado cargar un programa con un formato incorrecto.
Could not load file or assembly 'Crijoya.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Se ha intentado cargar un programa con un formato incorrecto.
Could not load file or assembly 'Crijoya.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Se ha intentado cargar un programa con un formato incorrecto.'
加载汇编时,我在Statup Configureservices方法上遇到此错误。这是代码:
//use and register all the mappings
services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies());
我尝试遵循这些解决方案,但我无法解决问题: 错误消息'无法加载一种或多种请求类型。检索LoadereXceptions属性以获取更多信息。'
I am building an API on Visual Studio 2019 net5.0 and I was just adding the lasts controllers and validators when my program suddenly stopped working.
The error that I'm getting:
System.Reflection.ReflectionTypeLoadException: 'Unable to load one or more of the requested types.
Could not load file or assembly 'Crijoya.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Se ha intentado cargar un programa con un formato incorrecto.
Could not load file or assembly 'Crijoya.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Se ha intentado cargar un programa con un formato incorrecto.
Could not load file or assembly 'Crijoya.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Se ha intentado cargar un programa con un formato incorrecto.
Could not load file or assembly 'Crijoya.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Se ha intentado cargar un programa con un formato incorrecto.
Could not load file or assembly 'Crijoya.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Se ha intentado cargar un programa con un formato incorrecto.
Could not load file or assembly 'Crijoya.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Se ha intentado cargar un programa con un formato incorrecto.
Could not load file or assembly 'Crijoya.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Se ha intentado cargar un programa con un formato incorrecto.
Could not load file or assembly 'Crijoya.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Se ha intentado cargar un programa con un formato incorrecto.
Could not load file or assembly 'Crijoya.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Se ha intentado cargar un programa con un formato incorrecto.'
I get this error on my Statup ConfigureServices method when loading the assemblies. Here's the code:
//use and register all the mappings
services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies());
I have tried following these solutions but I can't get to the problem:
Error message 'Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
因此,在我的情况下,dll file crijoya.core的格式不同,如错误所说。在尝试了其他问题之后,这对我有用。
我有一个项目,上面有两个类库,例如so
我确保在每个属性中,平台为任何cpu
Web项目的IIS Express的64位版本
So in my case the dll file Crijoya.Core was in a different format as the error says. After trying everything they said on other questions this is what worked for me.
I have a project with two class libraries like so
I made sure that in the properties of each of them the platform was Any CPU
And finally that on Tools I was using the 64 bit version for IIS Express for web projects