You may find this error while working with Data Application block in enterprise library. When you look into the inner exception you will find the message “The value can not be null or an empty string.”. This message does not give proper information to user.
When enterprise library does not find default database than it will show this error. You need to add “defaultDatabase” in web.config file to solve this error.
5: <add connectionString="" providerName="System.Data.SqlClient" name="ConnectionStr"/>
7: <dataConfiguration defaultDatabase="ConnectionStr" />
Fig – (1) Add DataConfiguration section to web.config file to avoid error
When you add <dataConfiguration defaultDatabase=”ConnectionStr” /> tag to web.config file you may get “Unrecognized configuration section dataConfiguration” error. Add “dataConfiguration” section in Configuration section to solve “Unrecognized configuration section dataConfiguration” error.
1: <section name="dataConfiguration"
2: type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=22.214.171.124, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
Fig – (2) Solution of Unrecognized configuration section dataConfiguration error
Read Full Post »
Posted in DotNet 3.0, Techincal on January 5, 2009|
14 Comments »
Today I was exploring Enterprise Library 4.1 and encounter this error. I created a sample application and added reference to few DLL from “EntLib41Src\bin” folder to my application. When I hit F5 to run the application I got following error,
“An error occurred creating the configuration section handler for exceptionHandling: Could not load file or assembly ‘Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=126.96.36.199, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)“
While searching for the reason I found a link here. According to this link assemblies in “EntLib41Src\bin” folders are not strong name assemblies. So when you run the application you will encounter error as shown above. While “Program Files\Microsoft Enterprise Library 4.1 – October 2008\Bin” folder contains strong name assemblies. You have to add reference from “Program Files\Microsoft Enterprise Library 4.1 – October 2008\Bin” folder in your application.
Happy Programming !!!
Read Full Post »