Bug Relating to Overlapping Application Pool Recycling in IIS and Nopcommerce 4.1 UsePluginShadowCopy

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
Hace 5 años
        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);
            //nop team fix
            {
                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;
            }
            //end nop team fix

            //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);
        }
Hace 5 años
to alldogsoffroad

I try to find solution with this Azure problem. I don't want to bother nop team now.
I did new release today.
http://foxnetsoft.com/content/files/Nop.Core.dll.zip
Can you try to check it on your test store with default nopcommerce settings.


Copy back default values and try this DLL.

    //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,

Thank you for your report.
Hace 5 años
@Foxnetsoft, isn't the idea to disable plugin shadowcopy?  In your appsettings.json note, you have usepluginsshadowcopy set to true.  Should this be set to false?

foxnetsoft wrote:
to alldogsoffroad

I try to find solution with this Azure problem. I don't want to bother nop team now.
I did new release today.
http://foxnetsoft.com/content/files/Nop.Core.dll.zip
Can you try to check it on your test store with default nopcommerce settings.


Copy back default values and try this DLL.

    //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,

Thank you for your report.
Hace 5 años
I want to check how this fix will work with default nopcommerce settings.
I copied this part of code from default appsettings.json
Hace 5 años
The nop team fix from nop 4.20 solved the problem with

Microsoft.AspNetCore.Mvc.Razor.Compilation.CompilationFailedException: One or more compilation failures occurred:


if you use this settings

"UsePluginsShadowCopy": false


Maybe this information will solve the time for another guys.
Hace 5 años
We are running 4.1 version, replaced a dll file with yours while keeping the original settings. The site crashed again.

Before that we tried with setting UsePluginShadowCopy to false but then we would get an error during a check out before the payment method is chosen.

any news regarding this problem?
Hace 5 años
Send to this topic the error message.
Maybe you have another one.
Hace 5 años
OK, if it happens again I will copy paste it, thanks (it has been working fine since last night)

regards
Hace 5 años
I have copied the given Core dll.
Made shadowcopy = false

The site stopped working at all. Received error regarding dependent dlls not found. Then I copied respective DLLs to every respective plugin folder for which I as receiving errors. Do you think it was required or am I missing something?

It's important because I still have many many new issues, that's why I thought I should ask, maybe I am going in the wrong direction at all.
Hace 5 años
Send full error message.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.