Starting an NServiceBus Host project throws an error when trying to setup the SQLite DB for sagas
The Init()
method on my IWantCustomInitialization
implementor is
public void Init()
{
NServiceBus.Configure.With()
.Log4Net()
.DefaultBuilder()
.MsmqTransport()
.IsTransactional(false)
.Sagas()
.NHibernateSagaPersisterWithSQLiteAndAutomaticSchemaGeneration()
.XmlSerializer();
}
The error is
Database was not configured through Database method. ---> System.Resources.MissingManifestResourceException: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure " System.Data.SQLite.SR.resources" was correctly embedded or linked into assembly "System.Data.SQLite" at compile time, or that all the satellite assemblies requi red are loadable and fully signed.
at System.Resources.ManifestBasedResourceGroveler.HandleResourceStreamMissing (String fileName) at System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet(Cultur eInfo culture, Dictionary`2 localResourceSets, Boolean tryParents, Boolean creat eIfNotExists, StackCrawlMark& stackMark) at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo reques tedCulture, Boolean createIfNotExists, Boolean tryParents, StackCrawlMark& stack Mark) at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo cultur e, Boolean createIfNotExists, Boolean tryParents) at System.Resources.ResourceManager.GetString(String name, CultureInfo cultur e) at System.Data.SQLite.SR.get_Keywords() in c:\dev\sqlite\dotnet\System.Data.S QLite\SR.Designer.cs:line 87 at System.Data.SQLite.SQLiteConnection.Schema_ReservedWords() in c:\dev\sqlit e\dotnet\System.Data.SQLite\SQLiteConnection.cs:line 1239 at System.Data.SQLite.SQLiteConnection.GetSchema(String collectionName, Strin g[] restrictionValues) in c:\dev\sqlite\dotnet\System.Data.SQLite\SQLiteConnecti on.cs:line 1223 at System.Data.SQLite.SQLiteConnection.GetSchema(String collectionName) in c: \dev\sqlite\dotnet\System.Data.SQLite\SQLiteConnection.cs:line 1176 at NHibernate.Dialect.Schema.AbstractDataBaseSchem开发者_Python百科a.GetReservedWords() at NHibernate.Tool.hbm2ddl.SchemaMetadataUpdater.GetReservedWords(Dialect dia lect, IConnectionHelper connectionHelper) at NHibernate.Tool.hbm2ddl.SchemaMetadataUpdater.Update(ISessionFactory sessi onFactory) at NHibernate.Impl.SessionFactoryImpl..ctor(Configuration cfg, IMapping mappi ng, Settings settings, EventListeners listeners) at NHibernate.Cfg.Configuration.BuildSessionFactory() at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory()
Versions:
- NServiceBus 2.5.0.1496
- System.Data.Sqlite 1.0.74.0
This version of SQLite for .NET is distributed as 2 dlls:
- System.Data.SQLite.dll
- SQLite.Interop.dll
Both dlls need to be present in the same folder as your EXE. Interop dll is platform specific so you have to manually (or Post-build) copy x86 or x64 version.
Another thing to keep in mind is that SQLite.Interop.dll itslef depends on MSVCR100.DLL (part of Visual C++ 2010 SP1 Redistributable Package). You can get it here:
- 64 bit version
- 32 bit version
Note the SQLite for .NET 3.5 requires Visual C++ 2008 SP1 Runtime. You can confirm that Interop assembly has all the necessary dependencies using Dependency Walker.
Workaround for this issue can be found here. But it might be a good idea to resolve the issue without applying the workaround.
精彩评论