nop 2.0 Plugin

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
11 years ago
phuongphan.itv wrote:
Hi Everybody, There is a good news for all of you whos facing this problem.. Try to remove all the temporary files located in Temporary ASP.NET Files and run again.. Hope this will help you

I've published my shop on the host. So that, i can't remove all temporary files.


You can try to re-upload your global.asax file or web.config to force the IIS to restart your application
11 years ago
7Spikes wrote:
Hi guys,

We would like to share some of the problems/solutions we experience during developing our plugins as obviously you experience the same problems.

All nopCommerce plugins have their views as embedded resources.
So the problem is in the way plugin assemblies are being loaded into memory.
Plugin assemblies are loaded at application start-up by the PluginManager class.

[assembly: PreApplicationStartMethod(typeof(PluginManager), "Initialize")]

So after you make a change to your plugins make sure you have restarted your application, so that the Initialize method to be executed and the changes to take an effect.

But that’s not all. NEVER copy any assembly in you plugin folder which is already present in the Nop.Web bin folder. As there might be many side effects from that because of the Temporary ASP.NET folders that contain shadow copied assemblies.
For this reason there might be cases when the same assembly is loaded twice(this was the case in Nop 2.0) in the the same AppDomain as the only difference is the location it has been loaded from  i.e if your plugin contains Nop.Web.Framework.dll then Nop.Web.Framework will be loaded from there and then will be shadow copied in the Temp Asp.NET folder but also it will be loaded again because it is in the bin folder of the application. This caused us a huge problem when we started developing nopCommerce plugins. All our plugins that referenced Nop.Web.Framework.dll used to copy local the referenced dll in their Plugins folders. So the Nop.Web.Framework assebly was loaded twice in the AppDomain. Then later when the AppFinder was asked for all types that implement IDependencyRegister it didn’t return the main DependencyRegister and we ended up with none of the main services being registered.
Then we realized the problem and made all references to have Copy Local set to False.
Now everything is working fine and we don’t have such problems anymore.

Another problem we had with our production web site is when we had a new version of a plugin and wanted to upgrade it. We uploaded the new assemblies and restarted the application BUT the old views were still used for some reason. To be honest we still don’t know why this happens even after several restarts of the server but we believe it is related to the Temp ASP.NET folder again. Unfortunately our hosting provider doesn’t allow us to see the Temp folder and they don’t tell us how we can clear it. So the solution we have found to this problem is to also update the Nop.Web.dll in the bin folder and somehow causing the Temp folder to be reinitialized.
We will be digging more into this and let you know if we can find what the real problem to this is.

Hope this helps!


thank 7Spikes, i've fixed my bug!
11 years ago
Hi,

I'm just working on my first plugin for nopCommerce, so please don't be too harsh :)

I receive the same error as described previously in this thread, "The controller for path '/Admin/Payment/ConfigureMethod' was not found or does not implement IController. "
From the forum here I have learnt that the reason for this is that the MVC cache file MVC-ControllerTypeCache.xml does not get updated unless the application restarts and therefore the route can not be found. Looking into this file, I indeed cannot see any sign of my plugin - so the error makes perfect sense.

The thing is: I am not sure why my plugin is missing from this xml file. The file is recreated every time I install or deinstall a plugin (nopCommerce version 2.80 which I believe doesn't require the global.asax to be edited any more; however, I have tried that as well, didn't help either). The views are compiled as embedded ressources. The PluginManager loads my plugin without problems before the application starts (in the Initialize method), and the DLL is listed in the system information loaded assemblies list. So.. I am totally lost on why the xml file does not contain my plugin.

Does anyone have an idea what might be causing this?

Thanks,

Roland
11 years ago
I am having the exact same problem. I have been looking for a solution for 4 days now and I am getting fed up with it since nothing works and all I see is reference to this thread to fix it! :-(

When running on localhost the problem can not be fixed like this and I can not debug code on the webserver so this is almost leading me to give up and find a different system. What is it that NopCommerce cant figure out about new plugins?! I understand that the problem is missing controller ref from that xml file, but that just doesnt help me getting any closer to a solution since all I see on the interwebs is references to this thread.

There are tons of threads where people describe the exact same problem, but no fix for it from Nops side and thats really lame if you ask me. When developing a plugin on a local computer how the hell are we (developers) suppose to workaround this annoying bug?

//Nicki
11 years ago
dshop wrote:
I am having the exact same problem. I have been looking for a solution for 4 days now and I am getting fed up with it since nothing works and all I see is reference to this thread to fix it! :-(

When running on localhost the problem can not be fixed like this and I can not debug code on the webserver so this is almost leading me to give up and find a different system. What is it that NopCommerce cant figure out about new plugins?! I understand that the problem is missing controller ref from that xml file, but that just doesnt help me getting any closer to a solution since all I see on the interwebs is references to this thread.

There are tons of threads where people describe the exact same problem, but no fix for it from Nops side and thats really lame if you ask me. When developing a plugin on a local computer how the hell are we (developers) suppose to workaround this annoying bug?

//Nicki


Hi Nicki,

What version are you using?? because I have never face this issues for latest version any more
11 years ago
In my experience (and I have developed quite a few plugins) the reason for these mischievous errors is usually one of two things:

1. As others have mentioned, you need to clear out your .Net Cache folder.
You CAN do this when debugging with Localhost, its just a little bit longer process.

To clear out your Temporary ASP.NET Files:
a. Stop IIS and/or Casini (the built in webserver) ... you have to stop the web server, not just the visual studio project
b. Navigate to the folder: C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files
c. Delete ALL files
d. Restart your application

In addition, I have also had to do this on the webserver, in some rare instances.   If you web host doesn't allow this, then you may need to have them recycle IIS or restart your site.  Some hosts offer this through their control panel, others require a separate technical support ticket.

2. If the above doesn't work, I have found (in some instances) that either all my files were not actually included in the assembly.
a. To check this, right click on the file you want, click properties.
b. Make sure the Build Action is set to "Embedded Resource"
c. Also, verify the path you specified as sometimes the MVC controller path does not match that of your assembly directly.
   You should be able to set that math in your RouteProvider.cs file (inside the actual plugin project)

Hopefully this will give you a little more information and help guide you down the path to a solution.  I have evaluated many other open-source Ecommerce products and I have to say that NOP is one of THE BEST.  Don't get discouraged, I have felt the same way in the past, but I have found that you will eventually find a solution.  

Finally, if you need additional help, my company, ATLANTA SBT, does offer Nop Development as a fee based service.  I am not trying to promote my company, but if you have the need, feel free to contact me at [email protected].
11 years ago
Hi,

in my case, the whole thing suddenly started to work and has been stable ever since.
I believe all I did was copying and adding the packages.config file from another plugin to my project. I am not sure whether that was what solved it (I was in a desparate try-and-click-everything situation) but I believe that was the last thing I did before it started working.

It might be a good idea to copy an existing plugin project and rename/modify/remove code you don't need rather than adding a brand new project and inserting code.

HTH,

brischt
11 years ago
etws14 wrote:
Hi Nicki,

What version are you using?? because I have never face this issues for latest version any more


I am using version 2.80. I have tried everything imaginable. What I did today was install nop from scratch with my plugin in the plugins folder. It gets installed perfectly but when I click configure it crashes. I have tripple checked all routes, spelling and all I can think of and still I can not get it to work. The plugin is bare minimum in functionality atm in order to only have the essetials tested. Basically only configure methods currently actually do something and that is all view related.

I love NopCommerce so far and this is really the only problem I have encountered so far after 3 weeks of development.

Best regards
11 years ago
Post your code somewhere so we can take a look and see if we can figure out what's wrong.
11 years ago
dshop wrote:
Hi Nicki,

What version are you using?? because I have never face this issues for latest version any more

I am using version 2.80. I have tried everything imaginable. What I did today was install nop from scratch with my plugin in the plugins folder. It gets installed perfectly but when I click configure it crashes. I have tripple checked all routes, spelling and all I can think of and still I can not get it to work. The plugin is bare minimum in functionality atm in order to only have the essetials tested. Basically only configure methods currently actually do something and that is all view related.

I love NopCommerce so far and this is really the only problem I have encountered so far after 3 weeks of development.

Best regards


Show me the error. so far I had developed more than 5 plugins and I never facing any problem for that.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.