ASP.NET EntLib 3.1 configuration question

Topics: Data Access Application Block, General discussion
Jun 19, 2007 at 4:36 PM
I have a main web application that has a web.config that defines a dataConfiguration section for EntLib 2.0 and I have a virtual directory with a web service that uses EntLib 3.1. It has its own web.config that defines a dataConfiguration sectiont that points to EntLib 3.1 assembly. The error I get when trying to go to the asmx page is -- Section or group name 'dataConfiguration' is already defined. Updates to this may only occur at the configuration level where it is defined. -- I though sub web.config files will override their parents so I shoudl be able to do this. What am I missing?

Thanks,
Travis
Jun 21, 2007 at 1:31 PM
Hi Travis,

There are two pieces of information in the configuration files: the section declaration (under configSections) and the actual section data. While child configuration files can supply additional information for a section, the section itself can only be declared once. The error you're getting is very likely caused by having both the parent and the child configuration files declaring the same section.

Unfortunately the configuration authoring tools from EntLib only deal with individual files, so they will always add a declaration for the sections you define. So if you use these tools on child configuration files you'll need to remove the section declarations for the inherited sections.

Now, I don't think configuration for EntLib 2.0 and 3.1 will just work in you scenario. Most of the configuration information includes type identity, like the sections themselves and the types in the configuration. You may need to set up a binding policy for your web service if you are to consume inherited configuration with the 2.0 version numbers, depending on your set up, but I haven't tried it myself.

Fernando
Oct 15, 2007 at 8:08 AM
I'd like to request for update on this thread. I am facing the same issue.

Any solution here? Thanks.
Oct 16, 2007 at 12:14 AM
Looking at the question-to-reply ratio (to say nothing of answers) of late it comes close to being downright rude, doesn't it?

--steve...
Oct 16, 2007 at 1:16 AM
haha.. didn't notice that steve.. it was my first time posting in this discussion list for this problem I had..

anyways.. did somebody solve a similar issue?.. can somebody share how they made it work??.. please please =)
Oct 17, 2007 at 12:07 AM
I have the same problem.
If I remove the section declarations, how fsimonazzi says, the error change, because the versions of EntLib are different:

An error occurred creating the configuration section handler for dataConfiguration: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Data, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Anyone have a workaroud for this issue?
Oct 22, 2007 at 11:02 PM
Hi,

I suggest you use the fusion log viewer to get more information about the nature of the failure. This blog post from Suzanne Cook will give you very good tips http://blogs.msdn.com/suzcook/archive/2003/05/29/57120.aspx.

Hope this helps,
Fernando


ric3ca wrote:
I have the same problem.
If I remove the section declarations, how fsimonazzi says, the error change, because the versions of EntLib are different:

An error occurred creating the configuration section handler for dataConfiguration: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Data, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Anyone have a workaroud for this issue?

Oct 22, 2007 at 11:08 PM
Hi,

There is actionable guidance on my answer from June 21th. Did you try it policy binding? Did it work for you? Is your scenario exactly the same? If not, how does it differ?

Regards,
Fernando


androtan wrote:
I'd like to request for update on this thread. I am facing the same issue.

Any solution here? Thanks.