回帖总数:
24
业力:
150
注册日期:
2010/9/24
位置:
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
回帖总数:
24
业力:
150
注册日期:
2010/9/24
位置:
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.
回帖总数:
24
业力:
150
注册日期:
2010/9/24
位置:
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...
回帖总数:
24
业力:
150
注册日期:
2010/9/24
位置:
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
回帖总数:
24
业力:
150
注册日期:
2010/9/24
位置:
Italy
strange for some reason GetCurrentIpAddress() in webhelper class don't like being called in a new thread...
回帖总数:
1168
业力:
12695
注册日期:
2011/11/15
位置:
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.