A Place for C Sharpers/.Netters

I Will do coding till last moment of life-Kiran Patil

Archive for the ‘Enterprise Library’ Category

An error occurred creating the configuration section handler for cachingConfiguration

Posted by kiranpatils on April 3, 2008

Server Error in ‘/DevelopmentWebsite’ Application.

Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: An error occurred creating the configuration section handler for cachingConfiguration: The given assembly name or codebase was invalid. (Exception from HRESULT: 0×80131047)

Line 139:        </authorizationProviders>
Line 140:    </securityConfiguration>
Line 141:    <cachingConfiguration defaultCacheManager=”Cache Manager”>
Line 142:        <cacheManagers>
Line 143:            <add expirationPollFrequencyInSeconds=”2000″ maximumElementsInCacheBeforeScavenging=”1000″ numberToRemoveWhenScavenging=”10″ backingStoreName

If you are also facing same error as above…then i have its solution. Here it is

Solution:

Just open your web.config file and locate <cachingConfiguration> under it <backingStores>

under it you will have <add   encryptionProviderName

this tag has attribute type here you will find

type=”Microsoft.Practices.EnterpriseLibrary.Caching.BackingStoreImplementations.NullBackingStore, Microsoft.Practices.EnterpriseLibrary.Caching, Version=3.1.0.0, Culture=neutral, PublicKeyToken=null” name=”Null Storage”/>

have you seen this publicKeyToken is null..so how can it work..yes this is the solution.

so just add publicKeyToken value to assembly’s Token…so you will have now

<add encryptionProviderName=”" type=”Microsoft.Practices.EnterpriseLibrary.Caching.BackingStoreImplementations.NullBackingStore, Microsoft.Practices.EnterpriseLibrary.Caching, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” name=”Null Storage”/>

Error is resolved..

Why this problem? 

I am not going to repeat its reason for problem. pls have a look at it from here:

http://blogs.msdn.com/echarran/archive/2006/07/13/665005.aspx 

Thanks a lot to this guy [if your error goes out then pls say thanks to echarran].

Posted in Enterprise Library | Tagged: | Leave a Comment »

Policy Injection – Unrecognized element ‘categories’+Enterprise Library+WCSF

Posted by kiranpatils on February 19, 2008

Hi, I have faced Unrecognized element ‘categories’ for PolicyInjection with EnterpriseLibrary under WCSF..Goggled it first than also not able to find any solution

StackTrace:

Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.


Parser Error Message: Unrecognized element ‘categories’.

Source Error:

Line 33: priority=”-1″ severity=”Information” type=”Microsoft.Practices.EnterpriseLibrary.PolicyInjection.CallHandlers.LogCallHandler, Microsoft.Practices.EnterpriseLibrary.PolicyInjection.CallHandlers, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”

Line 34: name=”Logging Handler”>

Line 35: <categories>

Line 36: <add name=”DataAccess” />

Line 37: </categories>

Source File: C:\Employee\Tests\Employee.Net.Host\web.config Line: 35

Solution:

Looks Strange na..but i have its solution.

1. Right Click your WCSF Host Application or for other under your solution where you have configure this block. as shown in Server Error in ‘<SOLUTION NAME>’ Application.

2. Add Reference->Locate Microsoft.Practices.EnterpriseLibrary.PolicyInjection.CallHandlers.dll [for me it is at :\Program Files\Microsoft Enterprise Library 3.1 - May 2007\Bin folder].

3. That’s it.

Have a Happy Policy Injection!!!

Posted in Enterprise Library, Web Service software Factory | 2 Comments »

Facing Problem in Enterprise Library-Caching Application Block+WCSF

Posted by kiranpatils on January 31, 2008

Yesterday i have wasted[or invested] my whole day in solving the error…hoohhh..

What i want to do?

I want to use Caching Application Block with WCSF. means when user clicks on submit i have to Cache that page using CAB of MEL. it seems simple but i am facing problem in implementing it.

Problem I was facing

When i calls CacheManager _cacheManager = CacheFactory.GetCacheManager();

it gives me error. I have pasted stack trace here.

Stack Trace is as under:
Could not load file or assembly Microsoft.Practices.EnterpriseLibrary.Common, Version=3.1.0.0, Culture=neutral, PublicKeyToken=null’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0×80131040)
System.TypeInitializationException was unhandled by user code
Message=”The type initializer for ‘Microsoft.Practices.EnterpriseLibrary.Caching.CacheFactory’ threw an exception.”
Source=”Microsoft.Practices.EnterpriseLibrary.Caching”
TypeName=”Microsoft.Practices.EnterpriseLibrary.Caching.CacheFactory”
StackTrace:
at Microsoft.Practices.EnterpriseLibrary.Caching.CacheFactory.GetCacheManager()
at Consensus.Net.Framework.Common.Caching.Cache.SetCache(String key, Object value) in C:\Latest Poc [Working Folder]\Consensus\Source\Consensus.Net.Framework\Consensus.Net.Framework\Caching\Cache.cs:line 38
at Consensus.Net.Web.Customer.CustomerController.cachepage(Booker booker) in C:\Latest Poc [Working Folder]\Consensus\UI\Consensus.Net.Web\Customer\CustomerController.cs:line 69
at Consensus.Net.Web.Customer.Views.DefaultViewPresenter.CachePage() in C:\Latest Poc [Working Folder]\Consensus\UI\Consensus.Net.Web\Customer\Views\DefaultViewPresenter.cs:line 64
at Customer_Default.btnSubmit_Click(Object sender, EventArgs e) in c:\Latest Poc [Working Folder]\Consensus\UI\Consensus.Net.Web\WebSites\DevelopmentWebsite\Customer\Default.aspx.cs:line 138
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

I have searched on google and blog also…But i am unable to find it out. and no help on codeplex also.. i have invested almost one day for it and i don’t want that you people also waste for the same problem

So here’s the solution:

Solution may look so simple but it is working fine and taken much of my time so its most precious for me.
Just add Microsoft.Practices.EnterpriseLibrary.Common.dll(i have it at “C:\Program Files\Microsoft Enterprise Library 3.1 – May 2007\Bin”) Version: 3.1.0.0 to GAC[if you don't know how to add it refer below step or Add it..].

Adding An Assembly to GAC
  1. Click the Assembly Cache node of the console tree. Alternately, you can click the Manage the Assembly Cache link in the pane on the right.
  2. Click the View List of Assemblies in the Assembly Cache link in the pane on the right.Alternately, you can right-click the Assembly Cache node, point to View on the shortcut menu, and select Assemblies.

    The tool displays all assemblies in the Global Assembly Cache in the pane on the right. The tool also displays all native image versions of assemblies in the cache. Native images are versions of assemblies that have been pre-compiled to native code using the Native Image Generator (Ngen.exe).

  3. To delete an assembly from the cache, right-click the assembly name in the pane on the right and choose Delete from the shortcut menu.
  4. To add an assembly to the cache, right-click the Assembly Cache node and choose Add from the shortcut menu. The tool displays the Add an Assembly dialog box. Navigate to the assembly to add.

That’s it .

Happy Caching!!!.

-Kiran Patil

Posted in Enterprise Library | Tagged: , , | 6 Comments »