Home  >  Forums  >  General  >  Development  >  nop 2.0 Plugin

nop 2.0 Plugin

< ... < 2 3 4 5 6 > ... >
Posted: October 12, 2011 at 7:21 AM Quote #51318
Hi guys,

As promised we did dig into the problem.
The real problem is not that easy to explain but we will give our best.

Problem:

In short it is related to how MVC works and partly to the plugin framework in nopCommerce.
When a new plugin is dropped in the Plugins folder and is installed into nopCommerce, even if the plugin has registered routes for its controllers, these routes will not be working as the MVC framework couldn't find the new controller types and couldn't instantiate the requested controller. That's why you get these nasty errors i.e "Controller does not implement IController" or even a more descriptive one "We're sorry, there is no Web page matching your request".

So here is what is actually going on.

1. When you start your nopCommerce application the MVC framework cashes all controller names in a file located in your ASP.NET Temporary folder. The location may differ but you can check in one of these locations:

C:\Users\<User Name>\AppData\Local\Temp\Temporary ASP.NET Files\root
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\

In the root folder there will be many other folders with fancy names like 03b0be9d or 54c3dd3a but you need to order them by date modified and open the latest one (this should be the one of your currently running application). Inside it there will be another folder with similar name and you need to open it as well. Now in the UserCache folder you will see a file MVC-ControllerTypeCache.xml.
This file contains all MVC registered assemblies and controllers in them and is used by MVC to resolve controller names.

On my machine the location looks like this (I use IIS Express):
C:\Users\<UserName>\AppData\Local\Temp\Temporary ASP.NET Files\root\54c3dd3a\99892c19\UserCache\MVC-ControllerTypeCache.xml

2. Now if you drop your new plugins to the Plugins folder and install them, you will notice that the newly installed plugin assembly and controllers are missing in the MVC-ControllerTypeCache.xml file.
That’s why MVC couldn't instatiate your controllers and you get these errors.
Note: Even manually restarting your web server(application) doesn't help this .xml file to be updated!

Solution:

It looks like forcing a kind of a restart(recompiling) of the application will lead to updating the MVC-ControllerTypeCache.xml file with the latest plugins installed.
There are many ways to force a restart(recompiling) in your web application as the ASP.NET engine watches for changes in several places i.e the bin folder of the application. But the simplest and easiest way is just to make a small change in the Global.asax file.
You can do this by opening the file in Notepad and simply add a blank space at the end of the file and then save it.
The Global.asax file is located in the main folder of your application(the same folder where the Web.config file is).
Make sure the Global.asax file has an updated date modified.

You should now be able to open the routes in your plugins.

Hope this helps!
This post/answer is useful
16
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
www.Nop-Templates.com - the best place for nopCommerce themes and plugins

Follow us on
Facebook: http://www.facebook.com/NopTemplates
Twitter: http://twitter.com/NopTemplates
Blog: http://www.nop-templates.com/blog

www.Nop-Templates.com
nopCommerce Solution Partners
Posted: October 12, 2011 at 8:09 AM Quote #51325
Thanks for the solution! Maybe, a 'Restart application' button (admin area) should also rewrite Global.asax file (just open and save without changes). It'll allow store owner to do it in admin area without any manual work.
This post/answer is useful
8
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Interested in the dedicated Premium support services provided by core developers? Please visit http://www.nopcommerce.com/supportservices.aspx

Regards,
Andrei Mazulnitsyn
Posted: October 12, 2011 at 8:20 AM Quote #51326
a.m. wrote:
Thanks for the solution! Maybe, a 'Restart application' button (admin area) should also rewrite Global.asax file (just open and save without changes). It'll allow store owner to do it in admin area without any manual work.


Hi Andrei,

Yes, this will be very useful especially for normal users(not developers) as they will probably not have access to their Global.asax file.
Actually they shouldn't even care that such file exists :)
They just want to drop a plugin(or even better if they could upload a .zip file with the plugin via the administration panel), install it and start using it.

Thanks
This post/answer is useful
4
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
www.Nop-Templates.com - the best place for nopCommerce themes and plugins

Follow us on
Facebook: http://www.facebook.com/NopTemplates
Twitter: http://twitter.com/NopTemplates
Blog: http://www.nop-templates.com/blog

www.Nop-Templates.com
nopCommerce Solution Partners
Posted: October 13, 2011 at 1:35 AM Quote #51437
7Spikes wrote:
Hi guys,


Solution:

It looks like forcing a kind of a restart(recompiling) of the application will lead to updating the MVC-ControllerTypeCache.xml file with the latest plugins installed.
There are many ways to force a restart(recompiling) in your web application as the ASP.NET engine watches for changes in several places i.e the bin folder of the application. But the simplest and easiest way is just to make a small change in the Global.asax file.
You can do this by opening the file in Notepad and simply add a blank space at the end of the file and then save it.
The Global.asax file is located in the main folder of your application(the same folder where the Web.config file is).
Make sure the Global.asax file has an updated date modified.

You should now be able to open the routes in your plugins.

Hope this helps!


Thanks a lot 7Spikes, it works perfectly :-)
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)
Br

Tommy Westerdahl
http://www.weroshop.dk - Themes and plugins for nopCommerce

Using nopCommerce 3.x.
Posted: October 13, 2011 at 12:36 PM Quote #51524
What about just killing the contents of the temp files folder? I've found many situations where old controls get cached in there and cause run time and even build errors.
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: October 13, 2011 at 4:47 PM Quote #51544
After wasting about 4 hours searching for a solution to this problem, I ran into this forum. Thanx alot for the solution! I always thought changing the Web.config would reload the application, but apparently it doesn't work for this kind of problems..
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: October 14, 2011 at 6:43 AM Quote #51619
I am trying to follow your instructions on installing the slider extensions plugin by Nope templates with no success, as i cant see the homeslider plugins under the config>plugin section. Is it due to nop 2.20 , i even changed the supported version to : 2.20 , just to check if the plugins comes up in the admin section. I also tried restarting the application by saving the global.asx..
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: October 14, 2011 at 9:39 AM Quote #51637
Hi guys,

You have downloaded an older version of the plugin.
The older versions are not compatible with nop 2.2.

All our plugins will support nopCommerce 2.2 and will be available for download later today from our website.
Please keep in mind that you need to change the Global.asax file after installing the plugins.
Just follow the instructions in the Help and you will be fine.


Hope this helps!
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)
www.Nop-Templates.com - the best place for nopCommerce themes and plugins

Follow us on
Facebook: http://www.facebook.com/NopTemplates
Twitter: http://twitter.com/NopTemplates
Blog: http://www.nop-templates.com/blog

www.Nop-Templates.com
nopCommerce Solution Partners
Posted: October 14, 2011 at 9:49 AM Quote #51639
How can we delete posts in the forum? We don't see a delete button :)
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)
www.Nop-Templates.com - the best place for nopCommerce themes and plugins

Follow us on
Facebook: http://www.facebook.com/NopTemplates
Twitter: http://twitter.com/NopTemplates
Blog: http://www.nop-templates.com/blog

www.Nop-Templates.com
nopCommerce Solution Partners
Posted: October 14, 2011 at 9:52 AM Quote #51641
creative3k wrote:
I am trying to follow your instructions on installing the slider extensions plugin by Nope templates with no success, as i cant see the homeslider plugins under the config>plugin section. Is it due to nop 2.20 , i even changed the supported version to : 2.20 , just to check if the plugins comes up in the admin section. I also tried restarting the application by saving the global.asx..


You cannot install it, and it is not listed in the plugins list in the administration because it does not support nopCommerce 2.2.

We are making the plugins available for nopCommerce 2.2 today.
This post/answer is useful
1
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
www.Nop-Templates.com - the best place for nopCommerce themes and plugins

Follow us on
Facebook: http://www.facebook.com/NopTemplates
Twitter: http://twitter.com/NopTemplates
Blog: http://www.nop-templates.com/blog

www.Nop-Templates.com
nopCommerce Solution Partners
< ... < 2 3 4 5 6 > ... >
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 2018
Learn more