Server Error in '/' Application File Load Exception

0

I am getting an error when trying to open the site. It works fine in Visual Studio and also works fine when published locally, but gives this error when built in Azure Devops:

Server Error in '/' Application.
Could not load file or assembly 'file:///D:\home\site\wwwroot\bin\App_Web_orhmujnn.dll' or one of its dependencies. Access is denied.

And here is the stack trace:

[FileLoadException: Could not load file or assembly 'file:///D:\home\site\wwwroot\bin\App_Web_orhmujnn.dll' or one of its dependencies. Access is denied.]
 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.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark) +102
 System.Reflection.Assembly.LoadFrom(String assemblyFile) +34
 WebActivatorEx.ActivationManager.get_Assemblies() +187
 WebActivatorEx.ActivationManager.RunActivationMethods(Boolean designerMode) +97
 WebActivatorEx.ActivationManager.RunPreStartMethods(Boolean designerMode) +36
 WebActivatorEx.ActivationManager.Run() +75

[InvalidOperationException: The pre-application start initialization method Run on type webActivatorEx.ActivationManager threw and exceoption with the following error message: Could not load file or assembly 'file:///D: \home\site\wwroot\bin\App_web_orhmujnn.dll' or one of its dependencies. Access id denied..]
 System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods, Func`1 setHostingEnvironmentCultures) +613
 System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +138
 System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +164
 System.Web.Compilation.BuildManager.ExecutePreAppStart() +156
 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +695


[HttpException (0x80004005): The pre-application start initialization method Run on type WebActivatorEx.ActivationManager threw an exception with the following error message: Could not load file or assembly 'file:///D:\home\site\wwwroot\bin\App_Web_orhmujnn.dll' or one of its dependencies. Access is denied..]
 System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +656
 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +89
 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +189

Doing a Ctrl + F5 on the page sometimes is returning a different dll but the bulk of the error is unchanged

I've checked the Azure Devops build settings and the match a previously working build. The web config and csproj also match a previously working build. I've also checked the site on PCs other than mine and the same error is occurring

c#
dll
azure-devops
azure-web-sites
asked on Stack Overflow Aug 7, 2019 by JGillardCCG

1 Answer

1

Clearing everything from wwwroot\bin fixed the issue after re-building. There's a console in the App Service on Azure where the directory can be emptied

answered on Stack Overflow Aug 7, 2019 by JGillardCCG

User contributions licensed under CC BY-SA 3.0