問題:MVC3應用程序 - 獲取「無法加載文件或程序集」System.Data.SQLite「或它的一個依賴關係。」
我正在構建一個C#4.0,基於MVC 3的Web應用程序。我使用SQLite作爲數據庫。
當我啓動應用程序,我得到這個錯誤:
無法加載文件或程序集「System.Data.SQLite」或它的一個依賴。試圖加載格式不正確的程序。
這是融合的組件負載跟蹤:
=== Pre-bind state information ===
LOG: User = Steve-PC\Steve
LOG: DisplayName = System.Data.SQLite
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: System.Data.SQLite | Domain ID: 2
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/Steve/Documents/Visual Studio 2010/Projects/EMMA3/EMMA_Web/
LOG: Initial PrivatePath = C:\Users\Steve\Documents\Visual Studio 2010\Projects\EMMA3\EMMA_Web\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\Steve\Documents\Visual Studio 2010\Projects\EMMA3\EMMA_Web\web.config
LOG: Using host configuration file: C:\Users\Steve\Documents\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\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:/Users/Steve/AppData/Local/Temp/Temporary ASP.NET Files/root/6454c2d1/d37faccb/System.Data.SQLite.DLL.
LOG: Attempting download of new URL file:///C:/Users/Steve/AppData/Local/Temp/Temporary ASP.NET Files/root/6454c2d1/d37faccb/System.Data.SQLite/System.Data.SQLite.DLL.
LOG: Attempting download of new URL file:///C:/Users/Steve/Documents/Visual Studio 2010/Projects/EMMA3/EMMA_Web/bin/System.Data.SQLite.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.
我使用:
Windows 7的64位 的Visual Web Developer 2010 IIS 7.5快遞 System.Data.SQLite 64 1.0。 77.0
我已經搜索了很多,一般認爲這與在64位上運行32位程序集有關係統或反之亦然。
事情我已經嘗試:
- 切換到IIS快遞從VS內置的Web服務器。顯然,內置服務器只能處理32位應用程序,IIS Express可以同時處理這兩種應用程序。不用找了。
- 請確保您使用的是64位版本的SQLite。最初,我使用常規版本,但改爲64位版本似乎沒有幫助。
- 在IIS中啓用「win 64上的32位應用程序」設置。 (在IIS Express中,這是通過使用appcmd.exe - appcmd set apppool /apppool.name:「」/ enable32bitapponwin64:true)來完成的。再次,這沒有改變。
- 卸載/重新安裝Sqlite。不用找了。
- 創建一個簡單版本的項目,以確保一切都乾淨並縮小原因。這導致我在下面的'重現步驟',但並沒有真正幫助我。
重現步驟:
- 創建新的MVC 3 web項目。
- 運行它,看它是否工作。
- 使用Nuget添加對SQLite x64的引用。
- 再次運行網站,它會出現此錯誤。
所以總結 - 我得到上面的錯誤,它肯定是以某種方式歸因於SQLite,我似乎擁有一切64位,但它仍然無法正常工作。有任何想法嗎?
在此先感謝。