Azure Web App Could not load file or assembly

0

I have 3 resource groups in Azure, with each 2 Azure Web apps (one of them in NorthEurope, the other in WestEurope) that sit behind a traffic manager. All of this is deployed through Azure ARM templates (the same templates for all Web Apps):

Visually:

DEV (Resource group)
    Traffic Manager
        WebApp in NorthEurope
        WebApp in WestEurope
DEV1 (Resource group)
    Traffic Manager
        WebApp in NorthEurope
        WebApp in WestEurope
PROD (Resource group)
    Traffic Manager
        WebApp in NorthEurope
        WebApp in WestEurope

I have deployed the exact same web application to each of those 6 WebApps (so, code, configuration and settings should all be the same).

All but one of the web apps are running perfectly fine. One of them (WebApp in WestEurope in Prod) fails with the following error message:

Could not load file or assembly 'GeoUK.OSTN' or one of its dependencies. 
Could not find or load a specific file. (Exception from HRESULT: 0x80131621)

The assembly was added through NuGet.

Things I have tried / checked:

  • Looking at the file system through Kudu, I can see the DLL is there.
  • A possible problem could be that the DLL is built for 32-bit and the application is configured for 64-bit or vice versa. I tried changing this but to no avail. If this was the case, it would also mean that none of the apps should be working
  • Deleted the web app and redeployed it through the ARM templates
  • It doesn't seem to be a region-issue as the WebApp in WestEurope on DEV is working correctly
  • At some point the WebApp in WestEurope in the resource group DEV1 was also failing. After deleting the WebApp and redeploying the ARM template it started working.

I'm not sure how else I can troubleshoot this issue. It just seems to randomly fail on that WebApp. Any pointers on what to check next would be greatly appreciated.

Complete StackTrace:

[FileLoadException: Could not load file or assembly 'GeoUK.OSTN' or one of its dependencies. Could not find or load a specific file. (Exception from HRESULT: 0x80131621)]
   System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
   System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +36
   System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +152
   System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +77
   System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +21
   System.Reflection.Assembly.Load(String assemblyString) +28
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +38

[ConfigurationErrorsException: Could not load file or assembly 'GeoUK.OSTN' or one of its dependencies. Could not find or load a specific file. (Exception from HRESULT: 0x80131621)]
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +738
   System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +217
   System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +130
   System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +170
   System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +92
   System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +290
   System.Web.Compilation.BuildManager.ExecutePreAppStart() +157
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +531

[HttpException (0x80004005): Could not load file or assembly 'GeoUK.OSTN' or one of its dependencies. Could not find or load a specific file. (Exception from HRESULT: 0x80131621)]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9947380
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +261
c#
asp.net
.net
azure
azure-web-app-service
asked on Stack Overflow Aug 31, 2016 by Kenneth • edited Aug 31, 2016 by Kenneth

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0