Exception: Failed to load file or assembly ' DAL ' or one of its dependencies--workaround

Source: Internet
Author: User
Tags reflection

Here is the following question in Factoy when I reuse the abstract Factory + reflection refactoring Room:

Went to the Internet to check the information, found that this is a very common problem, it appears mainly because of two kinds of reasons:

The first type:

Error loading DLL path. The workaround is to adjust the path of the D layer build DLL into the Bin folder of the UI. The following figure:

One of the principles of reflection is that everything is centered on the DLL name in the Bin folder of the UI layer, white, a DLL is a class library. The reflection I understand is a string of stitching that makes up the name of the class to instantiate. When using reflection to load a class, it is found by default from the bin in the UI layer, so the DLL for the D-tier class is generated under the Bin folder of the UI, so that it can be loaded successfully.

The second type:

Is the expansion of the first exception with the exception name: Failed to load the file or assembly "DAL" or one of its dependencies. An attempt was made to load a program that is not properly formatted. This exception is mainly due to the fact that the referenced project. NET version differs from the starting frame. If the operating system is 64-bit, but the published program references some 32-bit DDL, there is a compatibility issue.
Solution One: If you are a 64-bit machine, IIS ——-application pool-Advanced settings-enable 32-bit applications: true.
Solution Two: Modify project Properties--build--target platform (e.g., x86\x64)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.