0

The file is present, correctly named and not corrupted. If I move it out and back in from the "Bin", it works again, for about 5 minutes, then the error bellow comes back. Any operation that refreshes the file is fine, publishing it the anew, renaming or moving makes the site work again, for a moment.

{"Message":"Could not load file or assembly \u0027Ouranos, Version=1.0.0.0, Culture=fr-CA, PublicKeyToken=null\u0027 or one of its dependencies. Le fichier spécifié est introuvable.","StackTrace":" at Services.Asynchrone(String DimensionX, String DimensionY, String Action, String Culture, String Utilisateur, String Interface, String Source, String Champ, String Valeur, String Classement, String Direction, StriFileNotFoundExceptionng Page, String Itérations)","ExceptionType":"System.IO."}

Fusion did give me an error code (0x80070002), which pointed me to get Process Monitor. Which lead me to the temporary assembly folder. Now I may be wrong about this. Comparing the cache files from an healthy website and the sick one, I noticed something odd.

  • Healthy website as all the DLL from the BIN in cache.
  • The sick website is missing two DLL in the cache that are present in the BIN.

Now, I know that ASP.net tends to say that the main library is missing when it's in fact one of the referenced library that is missing. In this current situation I don't know what I could do to fix that problem. The two DLL are not set in the cache, thus when it tries to load the main DLL it fails locating the two others from the cache and throws a file not found on the main DLL.

The two culprits are:

  • PresentationCore.dll
  • WindowsBase.dll
Rv3
  • 59
  • 6

2 Answers2

0

To troubleshot this kinf of errors, you can use Fusion log, instructions about how to enable it and how to use it can be found here: How to enable assembly bind failure logging (Fusion) in .NET.

Community
  • 1
  • 1
Rafael
  • 2,827
  • 1
  • 16
  • 17
  • Fusion did give me an error code (0x80070002), I will edit my main post with new information. – Rv3 Sep 19 '12 at 01:07
  • Just a random though, according to this: http://stackoverflow.com/questions/8407850/using-presentationcore-and-windowsbase-dlls-in-both-x64-and-x86-environments, there are 32 bits and 64 bits versions of both assemblies, try forcing 32 bits mode on IIS and or your application and see if it helps. – Rafael Sep 20 '12 at 22:59
  • It's already in 32 bits, tried that before and it wasn't the problem sadly. – Rv3 Sep 21 '12 at 00:59
  • The problem really is "PresentationCore.dll" and "WindowsBase.dll", they don't cache because they are .net natives, but the only work for about 5 minutes after a file refresh, then it's down the drain – Rv3 Sep 21 '12 at 13:25
0

It would seem that the following code actually fixes the problem. It checks for all the required assemblies for the assembly and loads the missing. I had such a code before and it did not work, because without the !(Assemblée is System.Reflection.Emit.AssemblyBuilder) && (Assemblée.GetType().FullName != "System.Reflection.Emit.InternalAssemblyBuilder") was not present and has the code causing an exception in .net 4.0 and over. It's not elegant, but it does the job.

public static void Chargeur()
{
    var Assemblées_Chargées = (from Assembly Assemblée in AppDomain.CurrentDomain.GetAssemblies() where !(Assemblée is System.Reflection.Emit.AssemblyBuilder) && (Assemblée.GetType().FullName != "System.Reflection.Emit.InternalAssemblyBuilder") && (!Assemblée.GlobalAssemblyCache) && (Assemblée.CodeBase != Assembly.GetExecutingAssembly().CodeBase) select Assemblée).ToList();

    var Chemins_Chargés = Assemblées_Chargées.Select(Assemblée => Assemblée.Location).ToArray();
    var Chemins_Référencés = Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory, "*.dll");
    var Assemblées_NonChargées = Chemins_Référencés.Where(Références => !Chemins_Chargés.Contains(Références, StringComparer.InvariantCultureIgnoreCase)).ToList();

    Assemblées_NonChargées.ForEach(path => Assemblées_Chargées.Add(AppDomain.CurrentDomain.Load(AssemblyName.GetAssemblyName(path))));
}
Rv3
  • 59
  • 6