The 5th annual nopCommerce conference will take place in India on the 10th-11th of October. Please find more about this event here

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

< 1 2 3 4 5 >
Posted: February 18, 2019 at 11:01 AM Quote #221115
        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);
        }
This post/answer is useful
3
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: February 21, 2019 at 10:55 AM Quote #221257
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.
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: February 23, 2019 at 4:49 PM Quote #221330
@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.
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: February 24, 2019 at 1:21 AM Quote #221334
I want to check how this fix will work with default nopcommerce settings.
I copied this part of code from default appsettings.json
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: March 13, 2019 at 3:53 PM Quote #225007
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.
This post/answer is useful
2
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: March 20, 2019 at 6:14 PM Quote #225291
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?
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: March 21, 2019 at 3:03 AM Quote #225298
Send to this topic the error message.
Maybe you have another one.
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: March 21, 2019 at 5:12 AM Quote #225302
OK, if it happens again I will copy paste it, thanks (it has been working fine since last night)

regards
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: March 23, 2019 at 11:59 PM Quote #225390
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.
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Mantic
Posted: March 24, 2019 at 2:42 AM Quote #225397
Send full error message.
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
< 1 2 3 4 5 >
Premium support services
  • Dedicated premium support services provided by core developers are intended for persons who run mission critical websites, work on projects with tight deadlines, or want to get dedicated support.
Professional services
  • Want to open a new store? Want to take your store to the next level? Need a custom extension? We can customize nopCommerce to fit your store perfectly. Request a quote to get started.
eCommerce CONFERENCE 2019
Learn more