.NET Framework Bookmark and Share   
 index > .NET Base Class Library > Configuration issue on shared hosting.
 

Configuration issue on shared hosting.

I am using ent lib 3.1 and had to put attribute [assembly: AllowPartiallyTrustedCallers()] to Caching Common and ObjectBuilder to get this far. Now I am stuck with this:

An error occurred creating the configuration section handler for cachingConfiguration: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Caching, Version=3.1.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)

I am using a provider that uses Medium Trust. Anyone got a work around for this, or tell me whats going on?

Thanks,

zigy42
zigy42
Looks like you have a mismatch between the installed version of Enterprise Library and the version you referenced in your project. Using Fuslogvw.exe could be useful if you can't figure out where the bad assembly comes from.
nobugz

Hi zigy42,

To troubleshoot this issue, we really need the source code to reproduce the problem, so that we can investigate the issue in house. It is not necessary that you send out the complete source of your project. We just need a simplest sample to reproduce the problem. You can remove any confidential information or business logic from it.

Thanks!

Feng Chen
Looks like you have a mismatch between the installed version of Enterprise Library and the version you referenced in your project. Using Fuslogvw.exe could be useful if you can't figure out where the bad assembly comes from.
nobugz

I'm getting the same error.

web.config:

<configSections>
<section name="cachingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Caching.Configuration.CacheManagerSettings, Microsoft.Practices.EnterpriseLibrary.Caching, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</configSections>
<cachingConfiguration defaultCacheManager="Cache Manager">
<cacheManagers>
<add expirationPollFrequencyInSeconds="60" maximumElementsInCacheBeforeScavenging="1000"
numberToRemoveWhenScavenging="10" backingStoreName="Null Storage"
name="Cache Manager" />
</cacheManagers>
<backingStores>
<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" />
</backingStores>
</cachingConfiguration>

code:

Imports Microsoft.Practices.EnterpriseLibrary.Caching
Imports Microsoft.Practices.EnterpriseLibrary.Caching.Expirations

Partial Class test
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) _
Handles Me.Load

Dim cache As CacheManager
cache = CacheFactory.GetCacheManager()
cache.Add("key", "value", CacheItemPriority.Normal, Nothing, New SlidingTime(TimeSpan.FromMinutes(5)))

error:

happens in CacheFactory.cs -> public static CacheManager GetCacheManager():

configurationException{"An error occurred creating the configuration section handler for cachingConfiguration: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Caching, Version=3.1.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)

The following dll are referenced in the web project:

Microsoft.Practices.EnterpriseLibrary.Caching.dll (v3.1.0.0)

Microsoft.Practices.EnterpriseLibrary.Common.dll (v3.1.0.0)

morten71

My error only occurs at runtime when I try to get an .aspx page that uses the cachemanager.

When I added the [assembly: AllowPartiallyTrustedCallers()] attribute to the AssemblyInfo.cs file of Caching and Common and ObjectBuilderit fixed the first issue I was having. Which was Code Access Security issue of running in a medium trust environment.

I then rebuilt the enterprise library with the above attributes and then referenced the above mentioned DLL's in my project as well. I tried running FusLogvw.exe butno logs are created by default or in a custom location.I've never used that before so I could be doing it wrong...

When I add that attribute do I have to re-install the EntLib with the new attribute included? If so, how do I do that?

zigy42

I think I figured out my own problem. I got FusLogVW.exe working and it showed me the assembly that it was having trouble with. When I used the EntLibConfig.exe to add my caching configuration block it was adding a PublicKeyToken="blahblahblah" and the assembly it was expecting had a PublicKeyToken=null. So I just changed the PublicKeyToken in my web.config to null for the caching configuration block and it works.

So far no other errors in the application. Just thought I'd through this out there as a workaround. If there is a better one, I'd still like to know.

Thanks,

zigy42

zigy42
You'd want to fix it the other way around, to make sure your app uses the signed version of the assembly. That should be as easy as removing the reference and adding it back in, now pointing to a copy of the signed assembly. Then rebuild.
nobugz

You can use google to search for other answers

Custom Search

More Threads

• convert cli::array<unsigned char> into System::String
• CHeck if a string starts with a number
• BinaryReader - BigEndian to LittleEndian
• Problem in accessing remote registry
• Singleton vs. Shared class vs. Global object declaration.
• Windows API message ID's
• Data Structure Best Practice
• Al.exe and satellite assemblies
• List<T>.Sort Method (Comparison<T>)
• Rounding Inconsistency Between SQL Server and .NET