欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Could not load file or assembly 'XXX' or one of its dependen

程序员文章站 2022-10-03 23:50:52
当在IIS 7中发布C#web应用时,出现错误:Could not load file or assembly 'DatabaseAccess' or one of its dependencies. An attempt was made to load a program with an incorrect format.试图加载格式不正确的程序。...

当在IIS 中发布.net的web应用时,

出现错误:

Server Error in '/' Application.

Could not load file or assembly 'XXX' or one of its dependencies. 试图加载格式不正确的程序。

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
Exception Details: System.BadImageFormatException: Could not load file or assembly 'Credit.RatingApi' or one of its dependencies. 试图加载格式不正确的程序。

......


查找后判断是应用程序链接池 Application Pool调用的dll文件出现了错误,多是在于64位平台调用32位的dll引起的。

解决方式 : 找到发布的iis站点应用使用的应用程序池 Application Pool,点开高级设置->将"Enable 32-bit applications" 项目选择为true,兼容32位应用程序。