加载共享类库时出错
我有一个 ASP.NET 站点/WPF/Windows Phone 应用程序,它们都使用三个链接的项目。在数据项目 (Myproject.DAL) 中,我使用对 System.Data.SQLite 和 ICSharpCode.SharpZipLib 的引用。后者似乎是为 VS 中的运行时版本 2.0 编译的,尽管我下载了 4.0 版本(也许是我的误解)。
当我尝试加载 ASP.NET 4 站点时,出现错误:
Could not load file or assembly 'ChickenPing.DAL' or one of its dependencies. An attempt was made to load a program with an incorrect format.
我记得有此问题过去,它是由 System.Data.SQLite 库引起的,该库是一个 x86 二进制文件。我已经更新了,这绝对不是原因。所有项目都设置为以 .NET 4 x86 运行。有什么办法可以找出造成这种情况的实际原因吗?我猜测 DLL 一定是某个地方有问题,但 MSBuild 似乎没有报告任何问题。
尽管打开了 Fusion 日志记录,但我得到的唯一神秘错误是:
=== Pre-bind state information ===
LOG: User = IIS APPPOOL\CP
LOG: DisplayName = ChickenPing.DAL
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: ChickenPing.DAL | Domain ID: 9
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/Users/echilon/Documents/CP/
LOG: Initial PrivatePath = C:\Users\echilon\Documents\CP\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\echilon\Documents\CP\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/root/7bfa5a6e/c6574e91/ChickenPing.DAL.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/root/7bfa5a6e/c6574e91/ChickenPing.DAL/ChickenPing.DAL.DLL.
LOG: Attempting download of new URL file:///C:/Users/echilon/Documents/CP/bin/ChickenPing.DAL.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.
这并没有真正提供太多洞察力。
I have an ASP.NET site/WPF/Windows phone app which all use three linked projects. In the data project (Myproject.DAL), I'm using references to System.Data.SQLite
and ICSharpCode.SharpZipLib
. The latter seems to be compiled for runtime version 2.0 in VS, even though I downloaded the 4.0 version (perhaps my misinterpretation).
When I try to load the ASP.NET 4 site, I get an error:
Could not load file or assembly 'ChickenPing.DAL' or one of its dependencies. An attempt was made to load a program with an incorrect format.
I remember having this problem in the past and it being caused by the System.Data.SQLite library, which is an x86 binary. I've updated and this is definitely not the cause. All projects are set to run as .NET 4 x86. Is there any way I can track down the actual cause of this? I'm guessing the must be a problem DLL somewhere, but MSBuild does not seem to report any problems.
Despite turning on Fusion logging, the only cryptic error I get is:
=== Pre-bind state information ===
LOG: User = IIS APPPOOL\CP
LOG: DisplayName = ChickenPing.DAL
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: ChickenPing.DAL | Domain ID: 9
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/Users/echilon/Documents/CP/
LOG: Initial PrivatePath = C:\Users\echilon\Documents\CP\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\echilon\Documents\CP\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/root/7bfa5a6e/c6574e91/ChickenPing.DAL.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/root/7bfa5a6e/c6574e91/ChickenPing.DAL/ChickenPing.DAL.DLL.
LOG: Attempting download of new URL file:///C:/Users/echilon/Documents/CP/bin/ChickenPing.DAL.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.
Which doesn't really provide much insight.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实证明这是一个设置 - 应用程序池设置的“高级设置”部分中的“启用 32 位应用程序”。
This turned out to be a setting - "Enable 32 bit applications" in the "Advanced Settings" section of the app pool settings.