Database App Block works only localy

Topics: Data Access Application Block
Sep 9, 2011 at 1:12 PM

Hi All

We do heavily use of EntLib 5.0 in our projects and usually deploy them with required EntLib binaries in the same folder

However recently we decided to install EntLib 5.0 on our servers to have them all in one dedicated place on the machine so we don't need to copy them for each individual project.

The idea with installing EntLib to GAC obviously failed so we decided altering machine.config and added <codeBase> for all EntLib assemblies.

Eventually this worked, all applications which were depended on the EntLib run correctly even if there was no EntLib binaries placed in their forlder. All except ones which use Data Access Application block. For some annoying reason we constantly get this

Exception on Initialize Cache Activation error occured while trying to get instance of type Database, key "Database"/r/n   
at Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key) in c:\Home\Chris\Projects\CommonServiceLocator\main\Microsoft.Practices.ServiceLocation\ServiceLocatorImplBase.cs:line 57 at Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance[TService](String key) in c:\Home\Chris\Projects\CommonServiceLocator\main\Microsoft.Practices.ServiceLocation\ServiceLocatorImplBase.cs:line 103

So we have to place Microsoft.Practices.EnterpriseLibrary.Data.dll among with our applications

Is there any solution to this?

Sep 12, 2011 at 1:16 AM

Hi,

This is a known issue with Entlib 5.0 and already logged on this particular workitem. Christ Tavares also posted the work around on that link:

Found a workaround. Add this section to your configuration file:

<configSections>
<section name="typeRegistrationProvidersConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.TypeRegistrationProvidersConfigurationSection, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</configSections>

And the contents of the section:

<typeRegistrationProvidersConfiguration>
<remove name="Data Access" />
<add name="Data Access" providerType="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSyntheticConfigSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

<remove name="Validation" />
<add name="Validation" providerType="Microsoft.Practices.EnterpriseLibrary.Validation.Configuration.ValidationTypeRegistrationProvider, Microsoft.Practices.EnterpriseLibrary.Validation, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</typeRegistrationProvidersConfiguration>

 

Noel Angelo Bolasoc
Avanade Software
Avanade, Inc.
Contact Us

Sep 12, 2011 at 10:44 AM

Thanks a lot. Works like a charm.