Tổng Bài đăng:
24
Karma:
150
Đã tham gia:
24/09/2010
Vị trí:
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
Tổng Bài đăng:
24
Karma:
150
Đã tham gia:
24/09/2010
Vị trí:
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.
Tổng Bài đăng:
24
Karma:
150
Đã tham gia:
24/09/2010
Vị trí:
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...
Tổng Bài đăng:
24
Karma:
150
Đã tham gia:
24/09/2010
Vị trí:
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
Tổng Bài đăng:
24
Karma:
150
Đã tham gia:
24/09/2010
Vị trí:
Italy
strange for some reason GetCurrentIpAddress() in webhelper class don't like being called in a new thread...
MVP
Các lập trình viên được chứng nhận
Tổng Bài đăng:
1168
Karma:
12695
Đã tham gia:
15/11/2011
Vị trí:
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.