@foxnetsoft
We have done these steps and I am showing you the code which we added.
Steps we have done:
1- Changed the code as you mentioned above. (I have also pasted it below).
private static Assembly PerformFileDeploy(string plug, ApplicationPartManager applicationPartManager, NopConfig config, string shadowCopyPath = "")
{
var parent = string.IsNullOrEmpty(plug) ? string.Empty : _fileProvider.GetParentDirectory(plug);
if (string.IsNullOrEmpty(parent))
throw new InvalidOperationException($"The plugin directory for the {_fileProvider.GetFileName(plug)} file exists in a folder outside of the allowed nopCommerce folder hierarchy");
if (!config.UsePluginsShadowCopy)
{
//return RegisterPluginDefinition(config, applicationPartManager, plug);
var assembly = RegisterPluginDefinition(config, applicationPartManager, plug);
// delete the .deps file
if (plug.EndsWith(".dll"))
{
_fileProvider.DeleteFile(plug.Substring(0, plug.Length - 4) + ".deps.json");
}
return assembly;
}
//in order to avoid possible issues we still copy libraries into ~/Plugins/bin/ directory
if (string.IsNullOrEmpty(shadowCopyPath))
shadowCopyPath = _shadowCopyFolder;
_fileProvider.CreateDirectory(shadowCopyPath);
var shadowCopiedPlug = ShadowCopyFile(plug, shadowCopyPath);
Assembly shadowCopiedAssembly = null;
try
{
shadowCopiedAssembly = RegisterPluginDefinition(config, applicationPartManager, shadowCopiedPlug);
}
//nop team fix
catch (UnauthorizedAccessException)
{
/*var fileProvider = EngineContext.Current.Resolve<INopFileProvider>();
//suppress exceptions for "locked" assemblies, try load them from another directory
if (!config.CopyLockedPluginAssembilesToSubdirectoriesOnStartup ||
!shadowCopyPath.Equals(fileProvider.MapPath(NopPluginDefaults.ShadowCopyPath)))
{
throw;
}*/
if (!config.CopyLockedPluginAssembilesToSubdirectoriesOnStartup || !shadowCopyPath.Equals(_shadowCopyFolder))
throw;
}
//end nop team fix
catch (FileLoadException)
{
if (!config.CopyLockedPluginAssembilesToSubdirectoriesOnStartup || !shadowCopyPath.Equals(_shadowCopyFolder))
throw;
}
return shadowCopiedAssembly ?? PerformFileDeploy(plug, applicationPartManager, config, _reserveShadowCopyFolder);
}
2- Made UsePluginShadowCopy true. rest of the settings are the default.The application started well but it crashed with the same error message of accesss denied after a few hours.
Then I changed the UsePluginShadowCopy=false as @alldogsoffroad mentioned. This time application even didn't start and start sowing me error given below
------
Application startup exception: System.Exception: Plugin 'Nop One Page Checkout'. Could not load file or assembly 'SevenSpikes.Nop.Framework, Version=4.1.446.28460, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
Could not load file or assembly 'SevenSpikes.Nop.Framework, Version=4.1.446.28460, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
Could not load file or assembly 'SevenSpikes.Nop.Framework, Version=4.1.446.28460, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
Could not load file or assembly 'SevenSpikes.Nop.Framework, Version=4.1.446.28460, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
Could not load file or assembly 'SevenSpikes.Nop.Framework, Version=4.1.446.28460, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
Could not load file or assembly 'SevenSpikes.Nop.Framework, Version=4.1.446.28460, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
Could not load file or assembly 'SevenSpikes.Nop.Framework, Version=4.1.446.28460, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
Unable to load one or more of the requested types.
Could not load file or assembly 'SevenSpikes.Nop.Framework, Version=4.1.446.28460, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
Could not load file or assembly 'SevenSpikes.Nop.Framework, Version=4.1.446.28460, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
Could not load file or assembly 'SevenSpikes.Nop.Framework, Version=4.1.446.28460, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
--------
2 Days ago, we started copying required dlls into the respectie plugin folder which was showing error. By doing that way the application started well but all the plugins were actually not working.