0

J'ai essayé d'utiliser la journalisation dans Enterprise Library 6.0 dans VS2015 et l'exception suivante s'affiche . La référence Microsoft.Practices.EnterpriseLibray.Common est déjà ajoutée dans les références de VS2015.Impossible de charger le fichier ou l'assembly 'Microsoft.Practices.EnterpriseLibrary.Common, Version = 6.0.0.0, Culture = neutre, PublicKeyToken = 31bf3856ad364e35' ou

Server Error in '/' Application. 

Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Common, Version=6.0.0.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) 
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Common, Version=6.0.0.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) 

Source Error: 


An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

Assembly Load Trace: The following information can be helpful to determine why the assembly 'Microsoft.Practices.EnterpriseLibrary.Common, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded. 



=== Pre-bind state information === 
LOG: DisplayName = Microsoft.Practices.EnterpriseLibrary.Common, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 
(Fully-specified) 
LOG: Appbase = file:///c:/users/damarat/documents/visual studio 2015/Projects/LoginForm/LoginForm/ 
LOG: Initial PrivatePath = c:\users\damarat\documents\visual studio 2015\Projects\LoginForm\LoginForm\bin 
Calling assembly : Microsoft.Practices.EnterpriseLibrary.Configuration.DesignTime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35. 
=== 
LOG: This bind starts in default load context. 
LOG: Using application configuration file: c:\users\damarat\documents\visual studio 2015\Projects\LoginForm\LoginForm\web.config 
LOG: Using host configuration file: C:\Users\damarat\Documents\IISExpress\config\aspnet.config 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. 
LOG: Redirect found in application configuration file: 6.0.0.0 redirected to 6.0.0.0. 
LOG: Post-policy reference: Microsoft.Practices.EnterpriseLibrary.Common, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/b1f5e761/8f0d1b40/Microsoft.Practices.EnterpriseLibrary.Common.DLL. 
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/b1f5e761/8f0d1b40/Microsoft.Practices.EnterpriseLibrary.Common/Microsoft.Practices.EnterpriseLibrary.Common.DLL. 
LOG: Attempting download of new URL file:///c:/users/damarat/documents/visual studio 2015/Projects/LoginForm/LoginForm/bin/Microsoft.Practices.EnterpriseLibrary.Common.DLL. 
WRN: Comparing the assembly name resulted in the mismatch: Major Version 
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated. 



Stack Trace: 



[FileLoadException: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Common, Version=6.0.0.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)] 
    System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type) +0 
    System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) +145 
    System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) +158 
    System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg) +91 
    System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent) +438 
    System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType) +103 
    System.Reflection.RuntimeAssembly.GetCustomAttributes(Boolean inherit) +37 
    Owin.Loader.DefaultLoader.SearchForStartupAttribute(String friendlyName, IList`1 errors, Boolean& conflict) +106 
    Owin.Loader.DefaultLoader.GetDefaultConfiguration(String friendlyName, IList`1 errors) +46 
    Owin.Loader.DefaultLoader.LoadImplementation(String startupName, IList`1 errorDetails) +75 
    Owin.Loader.DefaultLoader.Load(String startupName, IList`1 errorDetails) +21 
    Microsoft.Owin.Host.SystemWeb.OwinBuilder.GetAppStartup() +115 
    Microsoft.Owin.Host.SystemWeb.OwinHttpModule.InitializeBlueprint() +28 
    System.Threading.LazyInitializer.EnsureInitializedCore(T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory) +115 
    Microsoft.Owin.Host.SystemWeb.OwinHttpModule.Init(HttpApplication context) +106 
    System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +534 
    System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172 
    System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +352 
    System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296 

[HttpException (0x80004005): Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Common, Version=6.0.0.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)] 
    System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9947444 
    System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101 
    System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +261 




Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1055.0 

Aidez-moi de le comprendre

Répondre

0

La DLL que vous faites référence pourrait être une version différente ou peut-être pas référencé du tout.

  1. Essayez de supprimer et de rajouter la référence. Essayez le Version Specific à false dans les propriétés.
+0

J'ai supprimé la référence 'commune' et ensuite trouvé que la DLL n'est pas disponible dans le système lorsque j'essaie de rajouter. –

+0

s'il n'est pas disponible, téléchargez l'assembly 'msdn' et ajoutez-le comme référence. [Vérifier ce lien pour l'installation de la bibliothèque d'entreprise] (https://msdn.microsoft.com/en-us/library/ff632023.aspx) @TarakeshwarRaju – ViVi

+0

lorsque j'ajoute common.dll de la version 6.0 l'exception apparaît sur cette version 3.1 .0.0 n'a pas pu être chargé et vice-versa. @ViVi –

0

eu le même problème, fixe avec réglage du paramètre « Activer les applications 32 bits » à « true » (dans les paramètres avancés de iis pool d'applications).

Egalement en tant que @ViVi déjà mentionné, essayez d'ajouter à nouveau les références et de reconstruire votre projet.