I'm trying to use Manageable Configuration Source with Group Policy. To try out these features I've modified Data Access Quick Start provided with EntLib 3.1. With EntLib configurator I've added Configuration Source and one Manageable Configuration Source
that points to MyApp.config file and has EnableGroupPolicies and EnableWmi set to True. Configuration Source SelectedSources is the ManageableConfiguration Source I've just created. Generated ADM template is published, configured and enabled on the Domain
Controller for the computer I'm testing this on. I've verifiyed that the HKLM\Software\Policies\Application (I've left the default name Application for this) is propagated to the client.
As i understand the point of GPO is to override MyApp.config if there are any settings set in the GPO (registry). Here's the problem, when I run the DataAccessQuickStart it loads only the settings in myapp.config (connection string that points to sqlServer1)
instead of the connection string that I've placed in GPO settings (sqlServer2). Am I missing something in the configuration files or is this meant to work completly different?
The point of this is to implement a feature in my application where system admins could set configuration settings based on Active Directory Organizational Unit computer memeberships by providing different GPOs for each OU. The workaround would be to create
different installation sources that could push these settings on different clients by giving them different assigned applications (again through GPO). But this workaround is definitivly harder to maintain.
Ok, solved this one after some debugging to see how this Manageability providers work from the inside. I've found out that Enterprise Library Configuration tool forgot to put some more tags into the app.config. MageabilityConfigurationSourceElement has manageabilityProviders
property that hasn't been created. It's a NameValueCollection kind of settings that you need to provide for manageable configuration section so I've added now my app.config looks like this:
<section name="enterpriseLibrary.ConfigurationSource" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection, Microsoft.Practices.EnterpriseLibrary.Common, Version=220.127.116.11, Culture=neutral, PublicKeyToken=null" />
<enterpriseLibrary.ConfigurationSource selectedSource="Manageable Configuration Source">
<add name="Manageable Configuration Source" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.Manageability.ManageableConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=18.104.22.168, Culture=neutral, PublicKeyToken=null"
filePath="MyApp.config" applicationName="Application" enableWmi="true"
<add type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.Manageability.ConnectionStringsManageabilityProvider, Microsoft.Practices.EnterpriseLibrary.Data, Version=22.214.171.124, Culture=neutral, PublicKeyToken=null"
I don't know why this wasn't added by EntLib config tool, but adding it manualy works.
This information should have been added by the configuration tool as you expected. That's the purpose of the
ConfigurationElementManageabilityProviderAttribute. I did a quick test and it did work for me, but I'll dig a bit deeper to see what could be happening here.