Thứ Ba, 21 tháng 11, 2023

[ASP.NET] Could not load file or assembly '*******' or one of its dependencies. An attempt was made to load a program with an incorrect format.

 Lỗi có dạng thông báo như sau :

Could not load file or assembly '*******' or one of its dependencies. An attempt was made to load a program with an incorrect format.

Nguyên nhân là do Source khi build có kèm theo dll (copy local=true) mà bản runtime này đã có được setup trên máy chủ. do đó hệ thống load cùng lúc 2 DLL dẫn tới lỗi.

Để khắc phục lỗi này thì hoặc remove bản runtime setup trên server hoặc đơn giản là xóa các dll liên quan trong thư mục bin của source đi là được