运行 ServiceStack 示例时出现 System.BadImageFormatException。
我正在尝试运行 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将主项目的平台目标设置为 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).
当尝试使用 64 位 IIS/pc 加载 32 位 sqlite.dll 时,这是一个问题。
要使其正常工作,您需要通过以下方式为您的 AppDomain“启用 32 位应用程序”:
为了获得更及时的答复,请随时将任何 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:
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