运行 ServiceStack 示例时的 System.BadImageFormatException. [英] System.BadImageFormatException on running ServiceStack examples.
问题描述
我正在尝试运行 ServiceStack 示例项目.当我运行 Web 客户端时,出现以下错误:
I am trying to run ServiceStack Examples projects. When I run the web client I am getting the following error:
{System.BadImageFormatException: An attempt was made to load a program with an
incorrect format. (Exception from HRESULT: 0x8007000B)
at Mono.Data.Sqlite.UnsafeNativeMethods.sqlite3_open_v2(Byte[] utf8Filename,
IntPtr& db, Int32 flags, IntPtr vfs)
at Mono.Data.Sqlite.SQLite3.Open(String strFilename, SQLiteOpenFlagsEnum
flags, Int32 maxPoolSize, Boolean usePool)
at Mono.Data.Sqlite.SqliteConnection.Open()
at ServiceStack.OrmLite.OrmLiteConnection.Open()
at ServiceStack.OrmLite.OrmLiteConnectionFactory.OpenDbConnection()
at ServiceStack.Examples.ServiceInterface.Support.ConfigureDatabase
.Init(IDbConnectionFactory connectionFactory)
in E:\ServiceStack.Examples\src\ServiceStack.Examples\
ServiceStack.Examples.ServiceInterface\Support\ConfigureDatabase.cs:line 23}
我已经下载了最新的 System.Data.SQLite.dll 文件并尝试使用它,但仍然出现相同的错误.我在 Windows 7 64 位机器上运行 64 位 VS2010.
I have downloaded latest System.Data.SQLite.dll file and tried to use it, but am getting still the same error. I am running 64-bit VS2010 on Windows 7 64-bit box.
推荐答案
将主项目的平台目标设置为 x86 以解决此问题.这可以在 Project... -> Properties -> Build 下完成.
Set the platform target of your main project to x86 to fix this. This can be done under Project... -> Properties -> Build.
SqlLite 很可能是 32 位组件,为了能够加载它,您的应用程序也需要是 32 位应用程序(64 位进程无法加载 32 位组件,反之亦然).
SqlLite is most likely a 32-bit components, and to be able to load it your application needs to be a 32-bit application as well (64-bit processes cannot load 32-bit components and vice versa).
这篇关于运行 ServiceStack 示例时的 System.BadImageFormatException.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!