hightownhill wrote:Hi guys-
We are using Azure for NOP Commerce 4.20. We are seeing some issues with plugins getting Acess Denied exceptions. Can someone please shed some light on what the issues are when using NOP 2.0 and Azure. Thanks!
Application startup exception: System.Exception: Plugin 'Work Truck Core Plugin'. Could not load file or assembly 'D:\home\site\wwwroot\Plugins\bin\WTS.Plugin.WorkTruck.Core.dll'. Access is denied.
Could not load file or assembly 'D:\home\site\wwwroot\Plugins\bin\WTS.Plugin.WorkTruck.Core.dll'. Access is denied.
---> System.Exception: Plugin 'Work Truck Core Plugin'. Could not load file or assembly 'D:\home\site\wwwroot\Plugins\bin\WTS.Plugin.WorkTruck.Core.dll'. Access is denied. ---> System.IO.FileLoadException: Could not load file or assembly 'D:\home\site\wwwroot\Plugins\bin\WTS.Plugin.WorkTruck.Core.dll'. Access is denied.
at System.Runtime.Loader.AssemblyLoadContext.LoadFromPath(IntPtr ptrNativeAssemblyLoadContext, String ilPath, String niPath, ObjectHandleOnStack retAssembly)
at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String assemblyPath)
at System.Reflection.Assembly.LoadFrom(String assemblyFile)
at System.Reflection.Assembly.UnsafeLoadFrom(String assemblyFile)
at Nop.Web.Framework.Infrastructure.Extensions.ApplicationPartManagerExtensions.AddApplicationParts(ApplicationPartManager applicationPartManager, String assemblyFile, Boolean useUnsafeLoadAssembly) in d:\a\1\s\src\Presentation\Nop.Web.Framework\Infrastructure\Extensions\ApplicationPartManagerExtensions.cs:line 160
at Nop.Web.Framework.Infrastructure.Extensions.ApplicationPartManagerExtensions.PerformFileDeploy(ApplicationPartManager applicationPartManager, String assemblyFile, String shadowCopyDirectory, NopConfig config, INopFileProvider fileProvider) in d:\a\1\s\src\Presentation\Nop.Web.Framework\Infrastructure\Extensions\ApplicationPartManagerExtensions.cs:line 208
at Nop.Web.Framework.Infrastructure.Extensions.ApplicationPartManagerExtensions.InitializePlugins(ApplicationPartManager applicationPartManager, NopConfig config) in d:\a\1\s\src\Presentation\Nop.Web.Framework\Infrastructure\Extensions\ApplicationPartManagerExtensions.cs:line 532
Check your appsettings.json file. Do they match the following?
//Enable if you want to clear /Plugins/bin directory on application startup
"ClearPluginShadowDirectoryOnStartup": true,
//Enable if you want to copy "locked" assemblies from /Plugins/bin directory to temporary subdirectories on application startup
"CopyLockedPluginAssembilesToSubdirectoriesOnStartup": false,
//Enable if you want to copy plugins library to the /Plugins/bin directory on application startup
"UsePluginsShadowCopy": true,
//Enable if you want to load an assembly into the load-from context, by passing some security checks
"UseUnsafeLoadAssembly": true,
We actually changed the UsePluginsShadowCopy to false. That resolved the issue. Although, we still see this exception occurring:
crit: Microsoft.AspNetCore.Hosting.Internal.WebHost[11]
Hosting startup assembly exception
System.InvalidOperationException: Startup assembly DiagnosticServices.HostingStartup failed to execute. See the inner exception for more details. ---> System.IO.FileNotFoundException: Could not load file or assembly 'DiagnosticServices.HostingStartup, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, IntPtr ptrLoadContextBinder)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, IntPtr ptrLoadContextBinder)
at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
at Microsoft.AspNetCore.Hosting.WebHostBuilder.BuildCommonServices(AggregateException& hostingStartupErrors)
We are trying to track down and resolve this issue currently. Will post here if we resolve the situation.
Thanks everyone!