简体   繁体   English

无法加载文件或程序集'Microsoft.Practices.EnterpriseLibrary.Caching

[英]Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Caching

In my Windows Service project, I have refereed Enterprise Library Caching 5.0.505 , but I get the following error on service start 在我的Windows Service项目中,我引用了Enterprise Library Caching 5.0.505 ,但是在服务启动时出现以下错误

Service cannot be started. System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Caching, Version=5.0.414.0, 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)
    File name: 'Microsoft.Practices.EnterpriseLibrary.Caching, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

App.Config App.Config中

<configSections>

    <section name="cachingConfiguration" 
             type="Microsoft.Practices.EnterpriseLibrary.Caching.Configuration.CacheManagerSettings, Microsoft.Practices.EnterpriseLibrary.Caching, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" 
             requirePermission="true" />
  </configSections>


<cachingConfiguration defaultCacheManager="Cache Manager">
    <cacheManagers>
      <add name="Cache Manager" 
           type="Microsoft.Practices.EnterpriseLibrary.Caching.CacheManager, Microsoft.Practices.EnterpriseLibrary.Caching, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" 
           expirationPollFrequencyInSeconds="60" 
           maximumElementsInCacheBeforeScavenging="50000" 
           numberToRemoveWhenScavenging="1000" 
           backingStoreName="NullBackingStore" />
    </cacheManagers>
    <backingStores>
      <add type="Microsoft.Practices.EnterpriseLibrary.Caching.BackingStoreImplementations.NullBackingStore, Microsoft.Practices.EnterpriseLibrary.Caching, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" 
           name="NullBackingStore" />
    </backingStores>
  </cachingConfiguration>

This occurs when the referenced assembly doesn't match with the one in the bin folder. 当引用的程序集与bin文件夹中的程序集不匹配时,就会发生这种情况。

Try adding this to your .config file: 尝试将其添加到您的.config文件中:

<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Practices.EnterpriseLibrary.Caching" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.0.505.0" newVersion="5.0.505.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法加载文件或程序集&#39;Microsoft.Practices.EnterpriseLibrary.Logging - Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Logging 无法加载文件或程序集Microsoft.Practices.EnterpriseLibrary.Configuration - Could not load file or assembly Microsoft.Practices.EnterpriseLibrary.Configuration “无法加载文件或程序集&#39;Microsoft.Practices.EnterpriseLibrary.Validation”异常 - “Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Validation” exception 企业库6 Microsoft.Practices.EnterpriseLibrary.Caching丢失了吗? - Enterprise library 6 Microsoft.Practices.EnterpriseLibrary.Caching missing? 无法在WCF中加载文件或程序集&#39;Microsoft.Practices.EnterpriseLibrary.Common - Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Common in WCF C#无法加载文件或程序集&#39;Microsoft.Practices.EnterpriseLibrary.Logging - C# Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Logging 无法加载文件或程序集“Microsoft.Practices.EnterpriseLibrary.Common”或其依赖项之一 - Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Common' or one of its dependencies 升级到EL 5&#39;Microsoft.Practices.EnterpriseLibrary.Caching ..或其依赖项之一时出错 - error while upgrading to EL 5 'Microsoft.Practices.EnterpriseLibrary.Caching ..or one of its dependencies “ Microsoft.Practices.EnterpriseLibrary.Caching.Cache”在未引用的程序集中定义 - 'Microsoft.Practices.EnterpriseLibrary.Caching.Cache' is defined in an assembly that is not referenced 无法加载文件或程序集“Microsoft.Practices.EnterpriseLibrary.Common,Version=6.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35”或 - Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Common, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM