## Friday, January 28, 2011

### Making System.Data.SQLite Work in an NServiceBus Endpoint

Today a colleague and I worked on getting an an NServiceBus endpoint in a .NET 4.0 project that referenced System.Data.SQLite to work properly. It turns out that this is not as straightforward as it may seem.

The System.Data.SQLite binaries are targeted for the .NET 2.0 runtime. When referencing a .NET 2.0 mixed mode assembly in a .NET 4.0 project, additional configuration is required:

OK, that's fine. But when running an NServiceBus endpoint in the NServiceBus.Host.exe executable, it seems that this setting in App.config does not get applied in the context of NServiceBus.Host.exe. So, to get this to work, we had to turn the NServiceBus endpoint into a console application with a Main method that used reflection to invoke the Main method of NServiceBus.Host.exe. Doing this enables the above setting to be applied in the context of NServiceBus.Host.exe.

It took us the better part of a day to figure this out, so I'm memorializing it here for (my own) future reference.

Udi Dahan said...

What you need to do is provide an NServiceBus.Host.exe.config file and put the startup section in there.

Unknown said...

Thank you a lot! It’s really helpful..Blackmart market helper Freestore

Anjali Arya said...

With our Escorts in Delhiand escorts services, you may really improve stage of fun by its quality services different. Sure! This assists its people to victory over all the gloom and depressive disorders from your lifestyle and appeases your delicate wishes specifically.So, you may do a trip at web page and can get your wish suggested with an outstanding woman escort. Check our other services also...
Hi Profile Escorts in Delhi
Russian Call Girls in Delhi
Escorts Service in Delhi — Front Page
Call Girls in Delhi
Call Girls in Vasant Kunj
Escorts Service in Aerocity
Escorts Service in Connaught Place
Escorts Service in Chanakyapuri
Escorts Service in Dwarka