我想跑步 ServiceStack 示例项目。运行Web客户端时,我会收到以下错误:

{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。

有帮助吗?

解决方案

将主项目的平台目标设置为X86以解决此问题。这可以在 项目...->属性 - >构建.

Sqllite很可能是32位组件,并且为了使其加载您的应用程序也需要是32位应用程序(64位流程无法加载32位组件,反之亦然)。

其他提示

试图使用64位IIS/PC加载32位SQLITE.DLL时,这是一个问题。

为了使其工作要工作,您需要为您的应用程序'启用32位应用程序。

  1. 开放IIS经理
  2. 单击应用程序池中的“高级设置”。
  3. 启用32位应用程序 真实

为了及时及时回复 ServiceStack Google Group.

更新:我忘了添加:您还需要最高级别的项目(即ASP.NET Web应用程序)将其构建配置设置为x86(32bit)。

如果您下载 最新版本的ServiceStack.Examples(v2.01) 现在应该在64位服务器上使用。

有关此的更多信息,可以在以下方式上跟踪:

https://groups.google.com/d/topic/servicestack/eupqf2ji4ig/discussion

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top