Total de publicaciones:
24
Karma:
150
Unido:
24/9/2010
Ubicación:
Italy
I have developed a task, and it's working fine. I would like to implement also the possibility to run this task once, manually, from the configuration page (for testing purpose) in background (the task take some time to complete). Does anyone know if it's possible manually execute in background a nopcommerce task and where should I look ? thanks for any help Tommaso
Total de publicaciones:
24
Karma:
150
Unido:
24/9/2010
Ubicación:
Italy
Uhm .... I don't think this is going to run in background / asynchronously ... this is just to call directly a class that implements ITask interface, and yes, works, but not in background.
Total de publicaciones:
24
Karma:
150
Unido:
24/9/2010
Ubicación:
Italy
I need the EF of nopcommerce , that is not thread safe... and i have no idea about instantiate a new context....or if is possible... I'm trying to understand nopcommerce Task logic , but ThreadTask have internal constructors and it's anyway too advanced for my skill...
Total de publicaciones:
24
Karma:
150
Unido:
24/9/2010
Ubicación:
Italy
ok.. looks like my dev environment was messed up... I suppose also the other solustion might work inside the controller you are using place: public ActionResult StuffToexecuteInBackground(DateTime StartSynchronizeFrom) { var plugin = RetrievePluginInstance(); ThreadPool.QueueUserWorkItem(plugin.Synchronize, objectWithParameters); return Configure(); } source: http://csharpfeeds.com/post/5415/Dont_use_the_ThreadPool_in_ASP.NET.aspx
Total de publicaciones:
24
Karma:
150
Unido:
24/9/2010
Ubicación:
Italy
strange for some reason GetCurrentIpAddress() in webhelper class don't like being called in a new thread...
MVP
Desarrollador Certificado
Total de publicaciones:
1168
Karma:
12695
Unido:
15/11/2011
Ubicación:
United States
You're not in a web context during a task on a separate thread. There is no HttpRequest to pull that info from.