猿问

“/”应用程序文件加载异常中的服务器错误

我在尝试打开该网站时遇到错误。它在 Visual Studio 中运行良好,在本地发布时也运行良好,但在 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.

这是堆栈跟踪:


[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


在页面上执行 Ctrl + F5 有时会返回不同的 dll,但大部分错误没有改变


我已经检查了 Azure Devops 构建设置并与之前工作的构建相匹配。Web 配置和 csproj 也与之前的工作版本匹配。我还在我以外的电脑上检查了该网站,也出现了同样的错误


呼啦一阵风
浏览 147回答 1
1回答

江户川乱折腾

清除 wwwroot\bin 中的所有内容修复了重建后的问题。Azure 上的应用服务中有一个控制台,可以在其中清空目录
随时随地看视频慕课网APP
我要回答