Posts

Showing posts from April 24, 2014

App_Offline.htm feature in ASP.NET 2.0

Image
"App_Offline.htm" feature in ASP.NET 2.0 provides a super convenient way to bring down an ASP.NET application while you make changes to it (for example: updating a lot of content or making big changes to the site where you want to ensure that no users are accessing the application until all changes are done). This is very handy when we do deployments manually. This allows you to remove the locks from those files and replace them, without the need to do a full IISRESET, taking down other sites on the server How this is implemented? We just need to put App_Offline.htmfile in root directory of web application and the ASP.NET runtime will detect the existence of  App_Offline.htm, if it exists, then the ASP.NET runtime will shut-down the application, unload the application domain from the server, and stop processing any new incoming requests for that application. When all Web site files have been copied, you can delete the App_offline.htm. Once remo...

Parallel programming in c# 4.0

In our daily programming routine we use thread mechanism to parallelize your code to distribute work across multiple processors .  To take advantage of the hardware of today and tomorrow Visual Studio 2010 and the .NET Framework 4 enhance support for parallel programming by providing a new runtime, new class library types, and new diagnostic tools. Let’s start with a simple concept in parallel programming. Data Parallelism (Task Parallel Library) Data Parallelism describes how to create parallel for and foreach loops. In this article we will look into simple for loop in parallel programming world. In this application I wrote a simple method to calculate the Root of a given number. Let’s look into the executing time of for and Parallel.For loop methods. The below code took me 16 seconds to execute. I am using 2.8-Ghz dual core 64 bit processor with 4 GB of RAM. for (int i = 2; i < 20; i++) { var result = SumRootN(i); ...