运行 ServiceStack 示例时出现 System.BadImageFormatException。

发布于 2024-10-12 01:13:46 字数 1065 浏览 5 评论 0原文

我正在尝试运行 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。

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}

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

乱世争霸 2024-10-19 01:13:46

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

SqlLite 很可能是 32 位组件,为了能够加载它,您的应用程序也需要是 32 位应用程序(64 位进程无法加载 32 位组件,反之亦然)。

Set the platform target of your main project to x86 to fix this. This can be done under Project... -> Properties -> Build.

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).

や莫失莫忘 2024-10-19 01:13:46

当尝试使用 64 位 IIS/pc 加载 32 位 sqlite.dll 时,这是一个问题。

要使其正常工作,您需要通过以下方式为您的 AppDomain“启用 32 位应用程序”:

  1. 打开 IIS 管理器
  2. 单击应用程序池上的“高级设置”。
  3. 启用 32 位应用程序设置为 true

为了获得更及时的答复,请随时将任何 ServiceStack 相关问题的链接发送到 ServiceStack Google 群组

更新:我忘了补充:您还需要最顶层的项目(即您的 ASP.NET Web 应用程序)将其构建配置设置为 x86(32 位)。

如果您下载最新版本的 ServiceStack.Examples (v2.01),这应该现在可以在 64 位服务器上运行。

有关此内容的更多信息,请访问:

https://groups.google.com/d/topic/servicestack /EUPqF2jI4ig/讨论

This is a problem when trying to load the 32bit sqlite.dll with a 64bit IIS/pc.

To get it to work you need to 'Enable 32-bit Applications' for your AppDomain by:

  1. Opening up IIS Manager
  2. Click 'Advanced Settings' on your Application Pool.
  3. Set Enable 32-bit Applications to true

For a more timely response feel free to send a link to any ServiceStack related questions to the ServiceStack Google Group.

Update: I forgot to add: you also need your top-most level project (i.e. your ASP.NET web application) to have its build configuration set to x86 (32bit).

If you download the latest version of ServiceStack.Examples (v2.01) this should now work on 64bit servers.

More information about this can be tracked on:

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文