Skip to main content


Showing posts from July, 2019

Data Parallelism (Task Parallel Library) with MaxDegreeOfParallelism set as ProcessorCount

It could be beneficial to run multiple threads to perform operations on different segments concurrently, so that certain tasks can be completed quicker (like some data updates using some services), and Data Parallelism   could help you, and in this scenario you can benefit from a powerful processor by writing a code as follows; ParallelOptions options = new ParallelOptions() { MaxDegreeOfParallelism = System.Environment.ProcessorCount }; Parallel.ForEach(mdList.AsEnumerable(), options, async row => {    result = await ProcessATask(param); }); For debugging purposes; you can replace the ParallelForEach with this following line to your checks for certain items; Parallel.ForEach(mdList.Select(“numbertocheck”).AsEnumerable(), options, async row => {    result = await ProcessATask(param); });

KUDU - Easily Removing Items from wwwroot

It is possible that after some big code changes(i.e. a big upgrade), you might have some issues with some old dlls, and in order to prevent some unexpected problems, you might want to remove everything under your Web App's wwwroot(or any other folder), and if this is the case, then you can Kudu for Azure Web Apps; Login to Azure Portal with your project's Azure credentials. Find your Azure Web App and copy its url and write the following command to remove all items from wwwroot. Get-ChildItem 'D:\home\site\wwwroot' | Remove-Item -Recurse -Force After doing this, you shouldn't see anything under wwwroot and you can then start your clean deployment(swap for my case).